πŸ“Š C++
Q. In the below example of constructor overloading, the following statement will call which constructor
Example obj = new Example (1,2,3);
Code:
class Example{
public: int a,b,c;
Example(){a=b=c=1;} //Constructor 1
Example(int a){a = a; b = c = 1;} //Constructor 2
Example(int a,int b){a = a; b = b; c = 1;} //Constructor 3
Example(int a,int b,int c){ a = a; b = b; c = c;} //Constructor 4
}
  • (A) Constructor 2
  • (B) Constructor 4
  • (C) Constrcutor 1
  • (D) Type mismatch error
πŸ’¬ Discuss
βœ… Correct Answer: (B) Constructor 4

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
209
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Omkar Shekhavat
Publisher
πŸ“ˆ
93%
Success Rate