class bagType { public: void set (string, double, double, double, double); void
ID: 662820 • Letter: C
Question
class bagType
{
public:
void set (string, double, double, double, double);
void print () const;
string getStyle () 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
This is the code I have to work with. It is the declaration of the class bagType.
a. How many members does class bagType have?
b. How many private members does class bagType have?
c. How many constructors does class bagType have?
d. How many constant function does class bagType have?
e. Which constructor is used to initialize the object newBag?
Explanation / Answer
(a)
The class has 12 members: 7 methods and 5 variables.
(b)
There are 5 private members of the class(the 5 variables).
(c)
There are 2 constructors of the class: 1 with no parameters, another with 5 parameters.
(d)
The class has 3 constant functions.
(e)
Teh defaule constructor(the one with 0 parameters) is used to initialize the object newBag
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.