0% found this document useful (0 votes)
86 views18 pages

C++ Classes and Objects

This document discusses key concepts of object-oriented programming in C++ including classes and objects, inheritance, overloading, polymorphism, data abstraction, encapsulation, and interfaces. It covers class member functions, access modifiers, constructors and destructors, copy constructors, friend functions, inline functions, the this pointer, pointers to classes, and static class members.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
86 views18 pages

C++ Classes and Objects

This document discusses key concepts of object-oriented programming in C++ including classes and objects, inheritance, overloading, polymorphism, data abstraction, encapsulation, and interfaces. It covers class member functions, access modifiers, constructors and destructors, copy constructors, friend functions, inline functions, the this pointer, pointers to classes, and static class members.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

C++ Classes and Objects

OOP

Classes and Objects in C++
Inheritance in C++
Overloading in C++
Polymorphism in C++
Data Abstraction in C++
Data Encapsulation in C++
Interfaces in C++ (Abstract Classes)
C++ Classes and Objects

Concept
Class member functions
Class access modifiers
Constructor & destructor
C++ copy constructor
C++ friend functions
C++ inline functions
The this pointer in C++
Pointer to C++ classes
Static members of a class
Class member functions

A member function of a class is a function that has its
definition or its prototype within the class definition
like any other variable
Class access modifiers

A class member can be defined as public, private or
protected. By default members would be assumed as
private.
Constructor &
destructor

A class constructor is a special function in a class that is
called when a new object of the class is created. A
destructor is also a special function which is called
when created object is deleted.
C++ copy constructor

The copy constructor is a constructor which creates an
object by initializing it with an object of the same class,
which has been created previously.
C++ friend functions

A friend function is permitted full access to private and
protected members of a class.
C++ inline functions

With an inline function, the compiler tries to expand
the code in the body of the function in place of a call to
the function.
The this pointer in C++

Every object has a special pointer this which points to
the object itself.
Pointer to C++ classes

A pointer to a class is done exactly the same way a
pointer to a structure is. In fact a class is really just a
structure with functions in it.
Static members of a class

Both data members and function members of a class
can be declared as static.
Inheritance in C++

Base & Derived Classes
Access Control and Inheritance
Type of Inheritance
Type of Inheritance
Overloading

Function overloading in C++
Operators overloading in C++
Overloadable/Non-overloadableOperators:
Polymorphism in C++

Polymorphism
Virtual Function:
Pure Virtual Functions
Data Abstraction in
C++

Access Labels Enforce Abstraction
Benefits of Data Abstraction
Data Abstraction
Designing Strategy
Data Encapsulation in
C++

Data Encapsulation
Designing Strategy
Interfaces in C++
(Abstract Classes)

Abstract Class
Designing Strategy

You might also like