0% found this document useful (0 votes)
21 views

Object Oriented Programming

The document discusses object oriented programming concepts including function overriding, inheritance types like public, private and protected, and container-ship relationships where a class contains objects of another class.

Uploaded by

Usama zahid
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)
21 views

Object Oriented Programming

The document discusses object oriented programming concepts including function overriding, inheritance types like public, private and protected, and container-ship relationships where a class contains objects of another class.

Uploaded by

Usama zahid
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/ 9

Object oriented programming language

SAADIA BANO
Lecturer
[email protected]
COMSATS Institute of Information Technology
Department of Computer Science,
Sahiwal
Function overriding

 Function Overloading is when multiple function with same name exist in a


class. Function Overriding is when function have same prototype in base
class as well as derived class.
 Function Overloading can occur without inheritance. Function
Overriding occurs when one class is inherited from another class
Example
Example
Example
Types of inheritance

 Public inheritance
Syntax: class child:public parent
 Private inheritance
Syntax: class child: private parent
 Protected inheritance
Syntax: class child:protected parent
How to access protected member of
parent class
Container-ship

 Class contains object of another class as its member


 This is also known as has-a-relationship

 Example:
Class A
{
};
Class B
{
A obj;
};
Example

You might also like