Professional Documents
Culture Documents
Class
• Instantiation of a class.
• In terms of variables, class would be the type and
an object would be a variable.
General Structure of a class
class class_name
{
private: private members or methods
…
…
…
public:
… Public members or methods
…
…
};
Private:
only members of that class have accessibility
can be accessed only through member functions of
that class.
Private members and methods are for internal
use only.
Public:
• Accessible from outside the class
• can be accessed through member function of any
class in the same program.
Protected:
• Stage between private and public access.
• They cannot be accessed from outside the class, but
can be accessed from the derived
class.(inheritance)
Class Example
Void main()
{
Customer C1;