This document provides an overview of object-oriented programming concepts like classes, objects, and inheritance. It defines key terms like base class, derived class, single inheritance, hierarchical inheritance, and multiple inheritance. It includes examples of different inheritance types written in C++, demonstrating how properties and behaviors can be inherited from superclasses to subclasses. The document is intended to explain inheritance and its various forms to readers learning object-oriented programming.
This is a Chapter extracted from the book 'Bella and Geeky Quba' published by baabtra.com for nourishing programmings skills in students at very early age itself. The book is aimed at primary and pre-primary school students to teach programming concepts through story lines and gaming environments
I prepared these for the student of FSC BSC BS Computer Science student. these slides are easy to read and understand the logic of OOP in C++. All topic is discussed and Example are given
This is a Chapter extracted from the book 'Bella and Geeky Quba' published by baabtra.com for nourishing programmings skills in students at very early age itself. The book is aimed at primary and pre-primary school students to teach programming concepts through story lines and gaming environments
I prepared these for the student of FSC BSC BS Computer Science student. these slides are easy to read and understand the logic of OOP in C++. All topic is discussed and Example are given
Object Oriented Programming concepts that are used for all the programming languages
The OOPs contains Class and Objects
It contains four main pillars
that are
Inheritance
Encapsulation
Polymorphism
Abstraction
with the four pillars OOPs are going to make our coding more efficiently
The OOPs help us in organizing the code in a formal way
it helps in code reusability
This PPT will help to understand how learning happens in brain. How you can adjust your skill acquisition in the right way so that maximum output is obtained.
Baabtra.com has a solution to provide programming for kids in school. This is based on the CBSE curriculum of India. The main subjects covered are Mathematics and Physics.
99LMS is a mobile based comprehensive enterprise learning environment in which learning processes of a company can be managed and integrated. It ensures employees have the right skills by enabling course content management, providing classroom training and e-learning. Through the APIs, you can develop your resources before they join your company.
3. CONTENTS
• CLASS
BASE CLASS
DERIVED CLASS
• OBJECT
• INHERITANCE
SINGLE INHERITANCE
MULTIPLE INHERITANCE
HIERARCHICAL INHERITANCE
MULTILEVEL INHERITANCE
HYBRID INHERITANS(Virtual
Inheritance)
4. CLASS
• Class is the base design of objects
means expanded concept of a data,
that can hold both data and functions.
• No memory is allocated when class is
created.
• It is a user defined data type.
Example : A car is consider
as a class
Methods : Engine, wheels,
steering.
Properties : company,
model, colour,
speed, etc….
5. BASE CLASS
• The class from which the subclass is
derived is called a superclass (also a
base class or a parent class).
DERIVED CLASS
• A class that is derived from another
class is called a subclass (also a derived
class, extended class, or child class).
6. OBJECT
• Object is the instance of class, means
identifiable entity with some
characteristics and behaviour.
• Memory allocated when only an
object is created.
7. EXAMPLE PROGRAM :
#include <iostream>
using namespace std;
class person
{
public:
string name;
int number;
};
int main()
{
person obj;
cout<<"Enter the Name :";
cin>>obj.name;
cout<<"Enter the Number :";
cin>>obj.number;
cout << obj.name<< obj.number;
}
Output :
Enter the name : baabtra
Enter the number:123
baabtra123
8. INHERITANCE
Deriving new class from existing class.
Object of one class contains the
property of another class.
Reusability.
We can add features to an
existing class without modifying it.
9. TYPES OF INHERITANCE
• Single Inheritance
• Hierarchical Inheritance
• Multi Level Inheritance
• Hybrid Inheritance
• Multiple Inheritance
10. SINGLE INHERITANCE
• One derived class inherits
from only one base class
• Most simplest form of
Inheritance.
11. EXAMPLE
#include<iostream>
using namespace std;
class father
{
public:
string name;
int age,pincode;
};
class child:public father
{
public:
string school;
int standard;
};
main()
{
father obj1;
child obj2;
cout<<"enter the name of father:";
cin>>obj1.name;
cout<<"enter the age of father:";
cin>>obj1.age;
cout<<"enter the pincode of father:";
cin>>obj1.pincode;
cout<<"-------------DETAIL OF CHILD--------------n";
cout<<"enter the name of child:";
cin>>obj2.name;
cout<<"enter the age of child:";
cin>>obj2.age;
cout<<"enter the pincode of child:";
cin>>obj2.pincode;
cout<<"enter the school name of child:";
cin>>obj2.school;
cout<<"enter the standard of child:";
cin>>obj2.standard;
}
13. EXAMPLE
#include<iostream>
using namespace std;
class user
{
public:
string name,place;
int age;
};
class student:public user
{
public:
int rollno,classs,mark1,mark2;
};
class teacher:public user
{
public:
string department;
int teacher_id,salary;
};
main()
{
user obj;
student obj1;
teacher obj2;
cout<<"-----------------STUDENT-------------n";
cout<<"enter the name:";
cin>>obj1.name;
cout<<"enter the age:";
cin>>obj1.age;
cout<<"enter the place:";
cin>>obj1.place;
cout<<"enter the rollno:";
cin>>obj1.rollno;
cout<<"enter the class:";
cin>>obj1.classs;
cout<<"enter the mark1:";
cin>>obj1.mark1;
cout<<"enter the mark2:";
cin>>obj1.mark2;
cout<<"---------------TEACHER---------------n";
cout<<"enter the name:";
cin>>obj2.name;
cout<<"enter the age:";
cin>>obj2.age;
cout<<"enter the place:";
cin>>obj2.place;
cout<<"enter the id:";
cin>>obj2.teacher_id;
cout<<"enter the salary:";
cin>>obj2.salary;
cout<<"enter the department:";
cin>>obj2.department;
}
19. EXAMPLE
#include<iostream>
using namespace std;
class father
{
public:
void fshow()
{
cout<<"discipline";
}
};
class mother
{
public:
void mshow()
{
cout<<"nopen minded";
}
};
class child:public father,public mother
{
public:
void cshow()
{
cout<<"nintelligent";
}
};
main()
{
father obj1;
mother obj2;
child obj3;
cout<<"QUALITY OF FATHERn";
obj1.fshow();
cout<<"n";
cout<<"nQUALITY OF MOTHER";
obj2.mshow();
cout<<"n";
cout<<"nQUALITIES OF CHILDn";
obj3.fshow();
obj3.mshow();
obj3.cshow();
}
20. Disclaimer: This presentation is prepared by trainees of
baabtra as a part of mentoring program. This is not official
document of baabtra –Mentoring Partner
Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
21. Follow us @ twitter.com/baabtra
Like us @ facebook.com/baabtra
Subscribe to us @ youtube.com/baabtra
Become a follower @ slideshare.net/BaabtraMentoringPartner
Connect to us @ in.linkedin.com/in/baabtra
Give a feedback @ massbaab.com/baabtra
Thanks in advance
www.baabtra.com | www.massbaab.com |www.baabte.com
22. Emarald Mall (Big Bazar Building)
Mavoor Road, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
NC Complex, Near Bus Stand
Mukkam, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
Cafit Square,
Hilite Business Park,
Near Pantheerankavu,
Kozhikode
Start up Village
Eranakulam,
Kerala, India.
Email: info@baabtra.com
Contact Us