Inheritence C Lab Exercise
Inheritence C Lab Exercise
1. Write a C++ program to add two numbers using single inheritance. Accept
these two numbers from the user in base class and display the sum of these two
numbers in derived class.
4. Write a C++ program to define a base class Item (item-no, name, price). Derive
a class Discounted-Item (discount-percent). A customer purchases 'n' items.
Display the item-wise bill and total amount using appropriate format.
5. Imagine in a college hires some lectures. Some lectures are paid in period basic,
while others are paid in month basic. Create a classed called lecture that stores
ID and name of lectures. From this class derive two classes: part time, which
adds payperhr (type float); and full time, which adds pay per month (type
float). Each of these three classes should have a readdata () function to gate its
data from user at the key board and printdata () function to display the data.
Write a main ()program to test the Full time and part time claases by creating
instance of them, asking the user to fill thir data with readdate () and display the
data with printdata().