Skip to content

Latest commit

 

History

History

Classes and Static Objects

What are classes 👀 ❓

Basic Syntx of class:

Basic Syntx of object:

we cannot access the dataMemebers of the class outside the class .Their members are by default-private.So when we want to access them .The error should come as

so when we want to access them outside the class,we use the access-identifiers.

Access-Identifiers

There are there Access specifiers.

  • Public

    Memebers of public are accessible from anywhere(accissble through the object).
  • Private

    Members declerad as private are only accessible within the class.
  • Protected

    Members are only accessible in child class.

Result:

Note:

The address of a class is same as the address of the first dataMemeber of the class