Inheritance
Why this program donât print out on the screen variables name and course when we use constructor? #include <iostream> #include <string> using namespace std; class Stu{ string name, course; public: Stu() {} Stu(string name, string course) { //parameterised consturctor this->name = name; this->course = course; } void showstud() { cout << "Name" << name << endl; cout << "Course " << course << endl; } }; class marks :public Stu { int m, p, c; public: marks(string name, string course,int m ,int p,int c) { Stu(name, course); this->m = m; this->p = p; this->c = c; } void showmarks() { cout << m << endl << p << endl<< c << endl; } }; void main() { marks ma("Ram", "Jam", 3, 4, 5); ma.showstud(); ma.showmarks(); }