Recent Changes - Search:

Oktatás

* Programozás 1
  + feladatsor
  + GitHub oldal

* Szkriptnyelvek
  + feladatsor
  + quick link

Teaching

Programming 1 (BI)
  ▸ exercises
  ▸ quick link

teaching assets


Félévek

* 2025/26/2
* archívum


Linkek

* kalendárium
* tételsorok
* jegyzetek
* szakdolgozat / PhD
* ösztöndíjak
* certificates
* C lang.
* C#
* D lang.
* Java
* Nim
* Nim2
  + exercises
* XC=BASIC
* old
  ✦C++, ✦Clojure, ✦Scala


[ edit | logout ]
[ sandbox | passwd ]

Static members

(1) static members
import std.stdio;

struct Point
{
    static int nextId = -1;

    int id;
    int x;
    int y;
}

Point makePoint(const int a, const int b)
{
    return Point(++Point.nextId, a, b);
}

void main()
{
    auto p1 = makePoint(1, 2);
    auto p2 = makePoint(6, 5);

    writeln(p1); // Point(0, 1, 2)
    writeln(p2); // Point(1, 6, 5)
}

Static members are shared by all of the objects. They're present in the memory just once.

Cloud City

  

Blogjaim, hobbi projektjeim

* The Ubuntu Incident
* Python Adventures
* @GitHub
* heroku
* extra
* haladó Python
* YouTube listák


Debrecen | la France


[ edit ]

Edit - History - Print *** Report - Recent Changes - Search
Page last modified on 2025 September 22, 17:10