Introduction To Object Oriented Programming
Introduction To Object Oriented Programming
For example, an instance of the class "Fruit" (a "Fruit" object) would be of the
type "Fruit". A class usually represents a noun, such as a person, place or
(possibly quite abstract) thing. Programming languages that include classes as
a programming construct subtly differ in their support for various class-
related features. Most support various forms of class inheritance. Many
languages also support advanced encapsulation control features, such as
access specifiers.
Object:
Is an Instance of class
Data Encapsulation and Data Abstraction is one of the most striking feature of object oriented
programming.
The wrapping up of data and code into a single unit is called data encapsulation. The data is
not accessible to the outside world only those functions which are wrapped into a class can
only access the private data of the class.
Contd…
The concept of data encapsulation is supported in C++ through the
use of the public, protected and private keywords which are placed in
the declaration of the class.
Note :
Anything in the class placed after the public keyword is accessible
to all the users of the class
Elements placed after the private keyword are accessible only to the
methods of the class.
Inheritance :
Contd…
A superclass, base class, or parent class is a class from
which other classes are derived. The classes that are
derived from a superclass are known as child classes,
derived classes, or subclasses.