Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 12

What is Class

• Class is the collection of Variables and Functions


• Class Members (Variables/Functions) Can be Accessed using Object of
that Class
• Object is also called instance of clas
• Class variables are also called Data Members and class functions
Member functions
4 Pillars of Object Oriented Programing
Abstraction
• Simply Public, private, protected Keywords
• We use abstraction to hide complexity of code from users and give
them access to only those things which are helpful for them.

• Means making functions and variables Public/private for users is


abstraction.
Encapsulation
• Its simply a concept of combining variables and functions to a single
unit
Inheritance
• Creating a class from another class to use its functionalities.
Types of Inheritance
• There are several types of inheritance eg:
Polymorphism
• Poly = Many
• Morphism = faces

• You react in Shopping mall as a Buyer


• You react on Road as a Driver
• You react at University as a student
Types of Polymorphism
Static polymorphism
• Function overloading
• Function overriding

• Overloading = same name same class (of functions)


• Overriding = Same Name different classes (of functions when we do
inheritance)
Pointers
• Type of variable which store address of a variable
Dynamic polymorphism
• Also called runtime polymorphism
• In Dynamic polymorphism binding happens at run time not compile
time.

• We use virtual functions

You might also like