Posts

Showing posts from October, 2023

220: Construct a class stack with member functions isEmpty, isFull, push, pop. Then make a class Human with data members name, father name and age. Then derive a class from it Student with data members rollNumber, department. Make a static count variable to check the total number of students anytime without calling object. Overload ++ operator that will increase the age of student by one. Your stack class should hold the record of every student.(array in stack class will be of student type)

  // Construct a class stack with member functions isEmpty, isFull, push, pop. Then make a class Human with data members name, father name // and age. Then derive a class from it Student with data members rollNumber, department. Make a static count variable to check the // total number of students anytime without calling object. Overload ++ operator that will increase the age of student by one. // Your stack class should hold the record of every student.(array in stack class will be of student type) #include < iostream > using namespace std ; const int stackSize = 10 ; class Human { private :     string name , fatherName ;     int age ; public :     Human ( string n = "" , string f = "" , int a = 0 ) { name = n , fatherName = f , age = a ; }     void setName ( string n ) { name = n ; }     void setFather ( string f ) { fatherName = f ; }     void setAge ( int a ) { age = ...