Recent Changes - Search:

Oktatás

* Programozás 1
  + feladatsor
  + GitHub oldal

* Szkriptnyelvek
  + feladatsor
  + quick link

Teaching

* Programming 1 (BI)
  ◇ exercises
  ◇ quick link

* Scripting Languages
  ◇ exercises
  ◇ quick link

teaching assets


Félévek

* aktuális (2023/24/2)
* 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