C++ MQCs with Explanation (CHAPTER 6: CONSTRUCTORS AND DESTRUCTORS)

Identify error, if any, in the following code segment: 1. class Sample 2. { 3. int m; 4. Sample ( ); 5. Sample (int); 6. };

  1. Line 6 should not have semicolon
  2. In line 5 parameter name is missing
  3. In line 4, argument should be of type void
  4. Constructors should be declared in public section



Answer: 
Option c: In line 4, argument should be of type void

Explanation Here

Post a Comment

0 Comments