Which of the following is the correct way to deifine double cube(double), a memb
ID: 3681342 • Letter: W
Question
Which of the following is the correct way to deifine double cube(double), a member function of the class, outside of the class definituon. a) double cube(double x) { return x*x*x*; } b) double Math::cube (double x) { return x*x*x* } c) Math ::cube (double x) { return x*x*x* } d) double math::cube (double x) { return x*x*x* } 2. For the following class, which is a correct default constructor: class Square { double side; }; a) void Square (); b) Square (): side(1) c) square (double s): side (s) {} d) Square(): bside(1) {} 3. Which of the following is a copy constructor prototype of the class Person a) Person (const Person&); b) Person (string, int); c) Person(); d) ^~Person(); 4. For the following class, which is a correct mutator function prototype: class ID { string value; }; a) string get Value (); b) double setValue (double); c) void setValue (string); d) void getValue(); 5. Which of the following is a proper assignment operator overloading prototype of the class Staff a) Staff operator=(const Staff&); b) Staff& operator=(const Staff&); c) Staff& operator=(); d) operator=(const Staff&); 6. For the following class, which is not a valid object instantiation: class Thing { public: Thing (string=""); Thing (string="", double=0.0,char); }; a Thing obj; b) Thing obj('A'); c) Thing obj("hey",9.4); d) Thing obj("Pie",3.2, 'D'); 7. The access specifier that allows access to members everywhere is a) Private b) public c) protected d) packageExplanation / Answer
1) b
2) a.void square();
3) a
4) c
5) b
6) a
7) Public
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.