How private instance of a class can be assigned values, C/C++ Programming

Assignment Help:

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


Related Discussions:- How private instance of a class can be assigned values

Luminous Jewels - The Polishing Game, plaese tell the full program for the ...

plaese tell the full program for the above given topic with the input and output

How do i develop a subscript operator for a matrix class?, Employ operator ...

Employ operator () instead of operator[]. While you have multiple subscripts, the cleanest way to do it is along with operator () instead of with operator[]. The reason is that

Explain about the expressions in c language, Explain about the Expressions ...

Explain about the Expressions in c Language? An expression is the combination of constants, variables and operators arranged as per the syntax of the language. Some of the illu

Determine the canonical form, Rule: To determine the canonical form we s...

Rule: To determine the canonical form we should OR the min terms. A min term is defined as a Boolean equation of the input if the output is logic '1'. If the input is logic '1'

A client and a server for an instant messaging system based , Develop a cli...

Develop a client and a server for an instant messaging system based on UDP and IPv4

How virtual functions can be implemented in c++?, Normal 0 fals...

Normal 0 false false false EN-US X-NONE X-NONE

Difference between mutex and binary semaphore, Semaphore is used to synchro...

Semaphore is used to synchronize processes. whereas mutex is used to give synchronization among threads running in the similar process.

Need squid web proxy with ffmpeg to convert flv to h.264, Need Squid Web Pr...

Need Squid Web Proxy with ffmpeg to convert flv to h.264 Project Description: We need a squid proxy setup with the modification that will transcode FLV to h.264 in real-time,

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd