C++ program to inherit derived constructor YASH PAL, 31 July 202422 August 2024 In this post, we will write a C++ program to inherit the derived constructor. C++ program to inherit derived constructor. #include<iostream> #include<conio.h> class base { private: int m; public: base() { m = 0; } base(int c) { m = c; std::cout<<"The count is = "<<m<<std::endl; std::cout<<"It is base class"<<std::endl; } }; class derived:public base { private: int q; public: derived():base() { q = 0; } derived(int p):base(p) { q = p; std::cout<<"The count = "<<q<<std::endl; std::cout<<"It is derived class"<<std::endl; } }; int main() { system("cls"); derived d; derived d1(10); getch(); return 0; } Output The count is = 10 It is base class The count = 10 It is derived class coding problems cpp