Object
• It is an instance of a class which has some physical or
logical significance.
• Example: Table, Chair, Mobile.
Class
• It is a collection of objects which is the building block
of Object Oriented Programming.
• It has its own data members and member functions
which define the behavior of Objects of the class.
, Declaration of classes Access Specifiers in a c
• These specify the access leve
Class Name
the members of the class.
Access • There are three types:
Member
Specifiers (1) Private
Variables (2) Public
(3) Protected
• Usually, the data members o
Member
Functions
class are declared in the priv
section of the class and the
Object of class member functions are in pub
student
section.
, Private Access Specifier
• The class members declared inside Private Access Specifier can be
accessed only by other members inside the class.
• An object cannot access the class members declared inside Private A
Specifier.
Public Access Specifier
• The class members declared inside Private Access Specifier can be
accessed by everyone – objects, other classes and other class memb
• If no Access Specifier is mentioned in a class, by default the Access
specifier is Private and not Public.
Protected Access Specifier
• This Access Specifier is mainly used in implementing Inheritance in OO
• The class members declared inside the Protected Access Specifier can
accessed only by Inherited classes and friend classes.
• It is an instance of a class which has some physical or
logical significance.
• Example: Table, Chair, Mobile.
Class
• It is a collection of objects which is the building block
of Object Oriented Programming.
• It has its own data members and member functions
which define the behavior of Objects of the class.
, Declaration of classes Access Specifiers in a c
• These specify the access leve
Class Name
the members of the class.
Access • There are three types:
Member
Specifiers (1) Private
Variables (2) Public
(3) Protected
• Usually, the data members o
Member
Functions
class are declared in the priv
section of the class and the
Object of class member functions are in pub
student
section.
, Private Access Specifier
• The class members declared inside Private Access Specifier can be
accessed only by other members inside the class.
• An object cannot access the class members declared inside Private A
Specifier.
Public Access Specifier
• The class members declared inside Private Access Specifier can be
accessed by everyone – objects, other classes and other class memb
• If no Access Specifier is mentioned in a class, by default the Access
specifier is Private and not Public.
Protected Access Specifier
• This Access Specifier is mainly used in implementing Inheritance in OO
• The class members declared inside the Protected Access Specifier can
accessed only by Inherited classes and friend classes.