0% found this document useful (0 votes)
39 views11 pages

Object-Oriented Programming C++

The document discusses object-oriented programming concepts in C++, including inheritance, visibility modes (public, private, protected), making private members inheritable, protected access specification, and multilevel inheritance. It explains that inheritance allows derived classes to inherit attributes and behaviors of base classes, and the visibility mode determines how elements of the base class are inherited, with protected making elements accessible to the derived class and its member functions. Multilevel inheritance refers to a chain of classes where a derived class inherits a base class that itself inherits another base class.

Uploaded by

Rajes Wari
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)
39 views11 pages

Object-Oriented Programming C++

The document discusses object-oriented programming concepts in C++, including inheritance, visibility modes (public, private, protected), making private members inheritable, protected access specification, and multilevel inheritance. It explains that inheritance allows derived classes to inherit attributes and behaviors of base classes, and the visibility mode determines how elements of the base class are inherited, with protected making elements accessible to the derived class and its member functions. Multilevel inheritance refers to a chain of classes where a derived class inherits a base class that itself inherits another base class.

Uploaded by

Rajes Wari
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/ 11

Object-Oriented Programming C++

UNIT-III

Prepared by
R.RAJESWARI
Assistant Professor in IT Dept
S.B.K.COLLEGE
Inheritance

class derived-class-name : visibility-mode base-class-name{


// ...
}
• three keywords: public, private, or protected
• determines how elements of the base class are inherited by the
derived class
Making a Private Member Inheritable
• Private member of a base class cannot be inherited
• Not available to derived class directly
• We can change private to public that will make accessible to all
other function.(There is no Data Hiding)
• C++ introduce third visibility modifier i.e., protected(limited
purpose in inheritance).
Protected
– accessible by the other member function within its class and
immediately derived class.
Protected

public mode private mode


1. accessible by derived class 1. accessible by derived class of
Of member function member function
2.Ready for further inheritance 2.not available for further inheritance
• Three keywords may appear in any order
Multilevel Inheritance

base class for


• B provide link
B Intermediate between A And
base class and
base class for
C
C • The chain ABC
is known as
inheritance Path

You might also like