Consider the following declarations and answer the 4 questio

Consider the following declarations and answer the 4 questions below:

class bagType

{

public:

void set(string, double, double, double, double);

void print() const;

string getStype() const;

double getPrice() const;

void get(double, double, double, double);

bagType();

bagType(string, double, double, double, double);

private:

string style;

double l;

double w;

double h;

double price;

};

bagType newBag;                                  // variable declaration

a-How many members does class bagType have?

b-How many private memebers does class bagType have?

c-How many constructors does class bagType have?

d-Which constructor is used to initialize the object newBag?

Solution

a-How many members does class bagType have?

Answer: 6

string style;

double l;

double w;

double h;

double price;

bagType newBag;

b-How many private memebers does class bagType have?

Answer: 5

string style;

double l;

double w;

double h;

double price;

c-How many constructors does class bagType have?

Answer: 2

bagType();

bagType(string, double, double, double, double);

d-Which constructor is used to initialize the object newBag?

Answer: bagType();

Consider the following declarations and answer the 4 questions below: class bagType { public: void set(string, double, double, double, double); void print() con
Consider the following declarations and answer the 4 questions below: class bagType { public: void set(string, double, double, double, double); void print() con

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site