C++ MQCs with Explanation (CHAPTER : INHERITANCE : EXTENDING CLASSES

Consider the following class class ABC { int a; int b; public : constructor function }; We wish to define the constructor function using an initialization list. Which one of the following is the legal constructor function?

  1. ABC (int x, int y): a (x), b(y) { }
  2. ABC (int x, int y): b (x), a(x+y) { }
  3. ABC (int x, int y): a (x), b(a*y) { }
  4. All the above



Answer: 
Option d: All the above

Explanation Here

Post a Comment

0 Comments