OOPS Concept
OOPS Concept
CLASS METHODS
Function inside the class
Function definition outside the class
Passing parameter to the function
CONSTRUCTOR
special method that is automatically called when an object of a class is created.
Constructor parameters
STATIC KEYWORD
static variable inside a class is shared among all instances of that class
Static data member and static member function
DESTRUCTOR
A destructor in C++ is a special member function of a class that is called
automatically when an object of that class is destroyed.
It is used to clean up resources allocated by the object before it is removed from
memory.
Destructors have the same name as the class preceded by a tilde (~).
ACCESS SPECIFIERS
Public - accessible from outside the class
Private - cannot be accessed (or viewed) from outside the class
Protected - cannot be accessed from outside the class, however, they can be accessed
in inherited classes.
By default, all members of a class are private if you don't specify an access specifier:
FRIEND CLASS FUNCTION
ENCAPSULATION
INHERITANCE
SINGLE INHERITANCE
MULTIPLE INHERITANCE
HIERARCHICAL INHERITANCE
HYBRID INHERITANCE
Hybrid inheritance is a combination of more than one type of inheritance.
POLYMORPHISM
COMPILE TIME
This type of polymorphism is achieved by function overloading or operator overloading.
Function Overloading
multiple functions with the same name.
Operator Overloading
RUN TIME
Function overriding
If derived class defines same function as defined in its base class, it is known as function
overriding in C++.
Virtual Function