This document provides an overview of the basic concepts of object-oriented programming including objects, classes, data abstraction, encapsulation, hiding, inheritance, polymorphism, binding, and message passing. Objects are instances of classes that interact at runtime and have state and behavior. Classes are collections of similar objects that bind data and functions. Access specifiers include private, public, and protected. Inheritance allows new classes to inherit properties from existing classes. Polymorphism allows different behaviors for the same operation. Binding links procedure calls to execution code. Message passing establishes communication between objects.
3. Objects are instance of a class, that interact with each
other at runtime. An object is an entity that has state,
behavior and identity. There are many objects around us.
E.g. A computer mouse is an object. Its states would be
its color, size and brand name and its behavior would be
left-click, right-click.
Objects
4. Class is a collection of similar objects or objects of same
type. Class is a way to bind the data and its associate
functions together. In the OOPs concept the variables
declared inside a class are known as "Data Members"
and the functions are known as "Member Functions".
By default all the elements of a class are private.
E.g. mango, apple and orange are members of class fruit.
Classes
5. There are three types of access specifiers are :
Private: The members declared as "private" can be
accessed only within the same class and not from
outside the class.
Public: The members declared as "public" are accessible
within the class as well as from outside the class.
Protected: The members declared as "protected" cannot
be accessed from outside the class, but can be accessed
from a derived class. This is used when inheritance is
applied to the members of a class.
Access Specifiers
6. Data Abstraction refers to the act of representing
essential features without including background details.
It is concerned with separating the behavior of a data
object from its representation.
E.g. Executable file of a program.
Data Abstraction
7. The process of binding the data members and functions
in a class is known as Data Encapsulation. By using
this concept data is not accessible to the outside world
and can access only those functions that are declared in
class.
Data Encapsulation
8. Data Hiding is the mechanism where details of the class
are hidden from the user. The user can perform only a
restricted set of operations in the hidden member of the
class. Data Hiding is similar to Data Encapsulation.
Data Hiding
9. Inheritance is a method by which new classes are
created from the existing classes. It inherits the
properties of base class into derived class.
Advantage is reusability of the code.
: symbol is used for inheriting a class.
Inheritance
10. Derived Class Visibility
Base Class
Visibility
Public
derivation
Private
derivation
Protected
derivation
Private Not inherited Not inherited Not inherited
Protected Protected Private Protected
Public Public Private Protected
The following table lists the visibility of the
base class members in the derived classes
11. Single Level Inheritance
Multiple Inheritance
Multilevel Inheritance
Hierarchical Inheritance
Hybrid Inheritance
Different types of inheritance in C++.
12. Polymorphism means ability to take more than one
form.
The process of making an operator to show different
behaviors in different instances is known as operator
overloading.
Using a single function name to perform different type
of task is known as function overloading.
Polymorphism
13. Binding refers to the linking of a procedure call to the
code to be executed in response to the call. There are
two types of binding:
Static Binding
Dynamic Binding
Binding
14. An Object Oriented program consists of a set of objects
that communicate with each other by sending and
receiving information much the same way as people
send messages to one another.
Message Passing
15. The message passing process involve
the following three steps:
Creating classes that define object and their behavior.
Creating objects from class definitions.
Establishing communication among objects.