Inheritance In C++
Thread Tags
Adobe Illustrator Adobe InDesign Adobe Photoshop Android Development Android Programming Android Studio Automation Testing bitmap file Brochure design C / C++ Programming Career Option Career Options College Lounge css CSS/HTML sandbox digital marketing Digital Marketing / SEO Fireworks Graphic Design Graphic designing Graphics Design Graphics Designing HTML? Illustrator Internship Training Liquify Tools logo Design logo designing Mobile UI Development Photoshop QA react-native Responsive Design SEO Testing Typography UI UI/UX Development UI Design UI Designing UI development User Interface UX Design Web Designing Website Design-
Register for free!
Registration at Smart Mentors is completely free and takes only a few seconds. By registering you’ll gain:
- Full Posting Privileges.
- Access to Private Messaging.
- Optional Email Notification.
- Ability to Fully Participate.
Register Now, or check out the Site Tour and find out everything Smart Mentors has to offer.
Tagged: C / C++ Programming
This thread contains 3 replies, has 4 voices, and was last updated by Bhasker Nimi 5 years, 7 months ago.
-
Author Replies
-
April 10, 2019 at 11:14 am #55611
How Many Types of Inheritance Are There In C++ Programming Language?
-
April 10, 2019 at 11:23 am #55613
There are 5 types of Inheritance in C++.
1) Single Inheritance
2) Multiple Inheritance
3) Hierarchical Inheritance
4) Multilevel Inheritance
5) Hybrid Inheritance (also known as Virtual Inheritance)
Regards,
Nitesh Bavishiya -
June 15, 2019 at 1:24 pm #58190
The capability of a class to derive properties and characteristics from another class is called Inheritance. Inheritance is one of the most important feature of Object Oriented Programming.
Sub Class: The class that inherits properties from another class is called Sub class or Derived Class.
Super Class:The class whose properties are inherited by sub class is called Base Class or Super class.// C++ program to demonstrate implementation
// of Inheritance#include <bits/stdc++.h>
using namespace std;//Base class
class Parent
{
public:
int id_p;
};// Sub class inheriting from Base Class(Parent)
class Child : public Parent
{
public:
int id_c;
};//main function
int main()
{Child obj1;
// An object of class child has all data members
// and member functions of class parent
obj1.id_c = 7;
obj1.id_p = 91;
cout << “Child id is ” << obj1.id_c << endl;
cout << “Parent id is ” << obj1.id_p << endl;return 0;
}OUTPUT:
Child id is 7
Parent id is 91To know more about this visit at: http://www.cetpainfotech.com/technology/C-Language-Training
-
-
AuthorPosts
You must be logged in to reply to this thread.Please login or register. Registration is 100% free.