CLASS

Class is made of data and functions.

OBJECTS

Objects are basic run time entity in object oriented system. They represent a place, a bank account,  or person.  Objects are the instance of class or a variable of user defined data types. When you declare a class there is no memory for data, after creation of class memory is allocated for data and this process is called as instantiation. Each object has its own copy of instance variable of its class. It means any changes to the variable of one object have no effect on another variable.

Data Abstraction

Data abstraction refers to the process of hiding complex and unnecessary information . classes use the concept of data abstraction. Real time example of data abstraction would be ATM machine user withdrawals cash without knowing it internal working, another example would be index of a book.

Data Encapsulation

Data encapsulation means encapsulating data and member function inside a single unit and this unit is nothing but a CLASS.  Data encapsulated inside this class is only accessible to the member function of class

Inheritance

Inherence is striking feature of OOP. Inheritance means one class inherits the properties of another class. Using Inheritance reusability can be achieved.

Polymorphism

Polymorphism is the ability to take more than one for.  Polymorphism means  function behaves according to the instance for example consider the operation of finding area if two arguments are passed to function it will return area of rectangle, if 3 arguments are passed it will return area of a cube.

Inline Function

Inline function is similar to macro. When normal function is called control is transferred to the function and this process takes lots of extra time in executing series of instructions to avoid this concept of inline function have been introduced. When inline function is called code associated with inline function is substituted. One biggest disadvantage of inline function is that wastage of memory.

Principles of OOP

Friend Function

As explained earlier that only member function can access private data of class but there could be situation when we need two classes to share a function. In such situation we can use a common function “FRIEND FUNCTION” . friend  function have access to both classes.

Syntax for friend function is as follows

Class Student

{

Private:

int mark1,mark2

Public:

int roll

void getdata()

{

Mark1=50;

Mark2=60;

}

Friend void myfriend(void)

};

Constructor

Constructor is a function it job is to do automatic initialization of data upon creation of object. Constructor neither take any argument  or return any value. Class name and constructor name is always same.

Written by Sourabh Bhunje

Sourabh Bhunje, B.E. IT from Pune University. Currently Working at Techliebe. Professional Skills: Programming - Software & Mobile, Web & Graphic Design, Localization, Content Writing, Sub-Titling etc. http://techliebe.com/about-us

Leave a Comment