0% found this document useful (0 votes)
17 views2 pages

Multiple Inheritance and Friend

Uploaded by

mdbillahmisbah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views2 pages

Multiple Inheritance and Friend

Uploaded by

mdbillahmisbah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

Create two classes, Shape and Color, and derive a class ColoredShape using multiple
inheritance. Demonstrate calling methods from both base classes.

2. Write classes Student and Sports. Derive a class Result using multiple inheritance that
calculates and displays the total marks and grade.

3. Create a class Box and make a separate class Display as a friend class to access and print
dimensions.

4. Write a Bank class and a friend class FriendAuditor that can access private account details.

5. Create two classes Distance1 and Distance2 and a friend function to compare which
distance is greater.

6. Write two classes ComplexA and ComplexB and use a friend function to add them.
7. Create a base class Shape with a virtual function area(), and derive Circle, Rectangle, and
Triangle classes.

8. Demonstrate function overloading with a function volume() to compute volume of cube,


cylinder, and sphere.

9. Create an abstract class Employee with a pure virtual function calculateSalary() and derive
different employee types.

10. Make an abstract class Drawable with pure virtual method draw() and derive shape classes
implementing it.

11. Create a base class Media with a virtual function play() and derive Audio and Video classes.

12. Have a base class Employee with virtual function bonus() and derive Manager, Developer,
and Intern.

13. Create an abstract class PaymentMethod with a pure virtual function pay() and derive
CreditCard, PayPal, and Cash.

14. Implement an abstract class Notifier with a pure virtual function notify() and derive
multiple notifier classes.

15. Design a system with classes Doctor and Nurse. Derive SurgeryTeam using multiple
inheritance, with a friend class HospitalAdmin and an abstract base class Person.

16. Design a class Book and a class Member. Create a BorrowTransaction class that inherits
from both and has a friend class Librarian.
17. Create an abstract class Person and derive Student and Teacher, then a TeachingAssistant
class using multiple inheritance.
18. Create a base class Product and abstract class Discount, and derive Electronics and
Clothing using multiple inheritance. Use a friend function to apply discount and tax.

19. Create a base class Transport and derive Bus, Train, and Flight. Make TransportAdmin a
friend class to access fare details.

20. Create an abstract class Policy and derive HealthPolicy and LifePolicy. Use a friend
function to calculate premium for a Customer.

21. Create class Vehicle and class Maintenance. Derive ServicedVehicle using multiple
inheritance. Make Garage a friend class.

22. Create an abstract class User, derive Student and Instructor, then use multiple inheritance
for a TeachingAssistant. Use a friend function to log login activity.

23. Create classes Show and Customer, then Booking using multiple inheritance. Make
Manager a friend class and use an abstract class for ticket printing.
24. Create an abstract class Device and derive Light, Fan, and AC. Make DeviceController a
friend class.
25. Create abstract class User and derive Client and Freelancer. Create JobContract using
multiple inheritance and use a friend function to display contract summary.

You might also like