Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

OOP: object oriented programming is not another programming language like

c++. It’s a different approach/concept to solve real life problems within c++
language.

Class: as we know class is group of things with similar properties. But in further
detail, we use keyword class in c++ to make a body of lines that contain functions
(member function) and variable (data members) so we could use them when
called.

Object: we create object of class to get access the function written in class.

Data members: variables within class that are used in different functions

Member function: function created according to your requirements within class.

Constructors: It is also a member function but a special one because when we


create an object in main function, constructor is automatically called and the lines
within constructors are executed. Mostly in constructors variables are initialized.
It is a special member function. It has same name as class name. It has no return
type.

Destructor: when you make a destructor within class, it deletes the object you
made and runs the lines within in the destructor. It runs after all the lines in main
function are executed. It has same properties of constructor just a single change
that it has symbol before its name known as Tilde ( ~ ).

Constructor/function overloading: it’s a concept that we can use same


constructor but with different parameters.Static data member/variable: if a
keyword static is used before declaring data member/variable, than the value of
that variable will be share among each and every function and their lifetime exits
till the end of program.

Friend function: if a keyword friend is used before declaring function, than that
function becomes friend function and it can access private and protected data
members/variables easily.

4 pilars of oop:

Abstraction: not having the main idea of the information, we just use it it for our
own puposes. Such as data types int, char, float we just use them but don’t know
how they work.

Polymorphism: reusing a function again and again whenever we call it

Encapsulation: combining same type of data into group/class

Inheritance: using functions of one class in another class

You might also like