Simple Inheritance In simple inheritance, there is only one super class and one sub class. This is the simplest of all the types of inheritance. Following program demonstrates simple inheritance: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 #include<iostream> using namespace std; class A { public: A() { cout<<“This is super class A”<<endl; } }; class B : public A { public: B() { cout<<“This is sub class B”<<endl; } }; int main() { B obj; } Output for the above
The post What are different kinds of inheritance in C++ Programming appeared first on Coding Security.
What are different kinds of inheritance in C++ Programming
read more
Tidak ada komentar:
Posting Komentar