In this blog we will learn what is inheritence and we will also learn how to use. this is my code which we have to run in the compiler so go to your compiler and run this program and check this........ // C++ program to demonstrate inheritance #include <iostream> using namespace std; // base class class Animal { public: void eat() { cout << "I can eat!" << endl; } void sleep() { cout << "I can sleep!" << endl; } }; // derived class class Dog : public Animal { public: void bark() { ...
Blogging my passion