Recent Changes - Search:

Oktatás

* Programozás 2
  + feladatsor
  + C feladatsor
  + Python feladatsor
  + GitHub oldal

* Szkriptnyelvek
  + feladatsor
  + quick link

* levelezősök
  + Adator. prog.
  + feladatsor
  + quick link

teaching assets


Félévek

* 2024/25/1
* archívum


Linkek

* kalendárium
   - munkaszüneti napok '20
* tételsorok
* jegyzetek
* szakdolgozat / PhD
* ösztöndíjak
* certificates
* C lang.
* C++
* C#
* Clojure
* D lang.
* Java
* Nim
* Scala


[ edit | logout ]
[ sandbox | passwd ]

20180407c

Class access modifiers

static class: the class cannot have instance variables or methods. They must all be static. The compiler will check this for you.

static constructor: initialize static class variables

public class Something
{
    public static int sharedNumber;    // class variable, belongs to the class

    static Something()
    {
        Something.sharedNumber = 3;
    }
}

Of course, here we could have simply written public static int sharedNumber = 3;

internal: it can be used inside the current project or assembly. An assembly is usually a single project in a compiled form (a single EXE or DLL).

class Book
{
...
}

For a class the default access modifier is inernal, thus the code above is equivalent to this:

internal class Book
{
...
}

If you want to use the class outside of the original project, then make it public:

public class Book
{
...
}
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 2018 April 10, 00:29