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

Find area under curve, write a c program to find the area under the curve4...

write a c program to find the area under the curve4 f=(x) between x=a and x=l integrate y=(x) between the limits of a and b Solution: #include float    start_point,

Minimum shelf, At a shop of marbles, packs of marbles are prepared. Packets...

At a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets with thes

Explain reference oddities, Reference Oddities A reference variable can...

Reference Oddities A reference variable can demote to any integer variable, be it in an array or a member variable from structure or class. Reference variables can demote to co

Queue - c++ program, Queue - C++ program: Write a program to show the ...

Queue - C++ program: Write a program to show the basic operations on queue. namespace stack {  const int max_size = 200;  char v(max_size);  int top=0;  void pu

Explain object-oriented programming, Explain Object-oriented programming ...

Explain Object-oriented programming Object-oriented programming (OOP) attempts to meet these requirements, providing methods for managing enormous complexity, achieving reuse o

Variables within c, Within software languages we have the ability to store ...

Within software languages we have the ability to store information in mail boxes i.e. memory slots which are given names to represent the box. The naming rules are governed by the

Define the classification of operators in c language, Define the Classifica...

Define the Classification of Operators in C Language? Depending on the function performed the operator can be classified as 1. Arithmetic Operator 2. Logical Operator 3. Inc

The Polishing Game, Byteland county is very famous for luminous jewels. Lum...

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

Lcm, lcm program.

lcm program.

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