q8: WAP to show parent function call inside child class having same member function name.
q9: WAP to show single inheritance with a method in the base class that gets called from the derived class.
q10: WAP to demonstrate single inheritance where the base class has private members accessed through public member functions in the derived class.
q11: WAP to show single inheritance with the derived class accessing protected members of the base class.
q12: WAP to show single inheritance where both base and derived classes have constructors and destructors.
q13: WAP to demonstrate single inheritance with method overloading in the derived class.
q14: WAP to show single inheritance with multiple parameterized constructors in the base and derived class.
q15: WAP to show single inheritance with virtual functions.
q16: WAP to demonstrate single inheritance where the derived class overrides the base class method and accesses the overridden method using a pointer to the base class.
q17: WAP to show single inheritance where the base class constructor requires an argument passed through the derived class constructor.
Multiple Inheritance
q1: WAP to show multiple inheritance constructor and destructor.
q2: WAP to show multiple inheritance with different function name.
q3: WAP to show the ambiguity in multiple inheritance.
q4: WAP to show multiple inheritance where both base classes provide different methods.
q5: WAP to demonstrate multiple inheritance where the derived class accesses public members of both base classes.
q6: WAP to show multiple inheritance where one base class contains a constructor, and the derived class calls the constructor.
q7: WAP to demonstrate multiple inheritance with two base classes having constructors and destructors.
q8: WAP to show multiple inheritance where one base class contains a method with a default argument.
q9: WAP to demonstrate multiple inheritance where the derived class calls methods from both base classes.
q10: WAP to show multiple inheritance with virtual inheritance to avoid ambiguity.
q11: WAP to demonstrate multiple inheritance where both base classes have the same function name, and the derived class resolves ambiguity.
q12: WAP to show multiple inheritance where the derived class implements polymorphism using function pointers.
q2: WAP to show multipath inheritance where a derived class accesses a method from both parent classes.
q3: WAP to demonstrate multipath inheritance where a base class constructor is called twice without virtual inheritance.
q4: WAP to show multipath inheritance where the base class has a common method and demonstrate how virtual inheritance resolves ambiguity.
q5: WAP to demonstrate multipath inheritance with constructors and destructors in both base and derived classes and show how virtual inheritance helps in correct constructor calling order.
q2: WAP to show multilevel inheritance with base, intermediate, and derived class.
q3: WAP to demonstrate multilevel inheritance where each class has its own method.
q4: WAP to show multilevel inheritance where each class contains its own constructor and destructor.
q5: WAP to demonstrate multilevel inheritance with virtual functions.
q6: WAP to show multilevel inheritance where the derived class overrides methods from both intermediate and base classes.
q7: WAP to demonstrate multilevel inheritance with method overriding and dynamic method dispatch using pointers.
Important
q1: Create a class called cricketer with member variables to represent name, age, and number of matches played. From this derive two classes Bowler and Batsmen. Bowler class has number of wickets as member variable and Batsmen class has number of runs and centuries as member variables. Use appropriate member functions in all classes to read and display respective data.
q2: Create a class student with data members student ID and name. Create class internal exam with marks first as data member and external exam with marks second. Create class result by inheriting class internal exam and external exam that will add marks of class internal exam and external exam.
q3: WAP to show order of constructor(default, parameterized) and destructor call in multiple inheritance. Base class one ename and class two have employee id and child class result.
q4: WAP to convert object from class that represent weight of gold in Nepal, tola to object of a class that represent internal gold measurement of weight in gram scale.
q5: WAP with three classes students, test, and result by using multi level inheritance. Assume necessary member and function yourself and program with input information input data and calculate marks total and display result.
q6: WAP to demonstrate hybrid inheritance where a derived class inherits from both single and multiple inheritance and show how ambiguity is resolved using virtual base classes.
q7: WAP to create a base class Shape with derived classes Rectangle, Triangle, and Circle. Each derived class should have a method to calculate the area. Use appropriate constructors to initialize and calculate the area for different shapes.
q8: Create a class Person with attributes name and age. Derive classes Employee and Student from Person. Use virtual functions to display different information for Employee (salary) and Student (grade).
q9: WAP to demonstrate runtime polymorphism using a base class pointer and derived classes where a method is overridden in each derived class. Show how the base class pointer calls the derived class method during runtime.
q10: WAP to implement an example of friend classes where one class can access private and protected members of another class.