question 1a explain clearly the following


Question 1:

(a) Explain clearly the following concepts using suitable examples of your own:-

(i) concrete class v/s abstract class
(ii) constructor v/s overloaded constructor
(iii) single inheritance v/s multiple inheritance
(iv) polymorphism v/s data encapsulation

(b) (i) Explain how a static method can be used in a program to access data members?

(ii) Explain how private instance variables of a class can be assigned values?

Question 2:

(a) Write down the abstract class 'BloodDonor' to contain the following:-

(i) integer variable: donor_id
String variables: donor_name, address
double-precision variable: bloodAmount
(ii) set methods for data members: donor_id, donor_name, address
(iii) get methods for all data members
(iv) abstract method 'giveBlood' which returns nothing

(b) Write down the subclass 'Student' to contain the following:-

(i) integer variable: student_id
(ii) set method for the data member
(iii) get method for the data member
(iv) override the abstract method 'giveBlood' to assign a value of 1.0 to the attribute 'bloodAmount'

(c) Write down the subclass 'StaffWorker' to contain the following:-
(i) double-precision variable: salary
(ii) set method for the data member

(iii) get method for the data member
(iv) override the abstract method 'giveBlood' to assign a value of 2.0 to the attribute 'bloodAmount'

(d) Write down an application to perform the following tasks:-
(i) create one 'Student' object and one 'StaffWorker' object
(ii) assign values to the data members of each object
(iii) display all the values

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: question 1a explain clearly the following
Reference No:- TGS0373937

Expected delivery within 24 Hours