You are not logged in.

#1 2015-05-26 06:31:50

hasnain
Administrator
From: Chichawatni
Registered: 2014-10-13
Posts: 8,355
Website

Constructor:

Question:
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
}
In the above example of constructor overloading, the following statement will call which constructor
Example obj = new Example (1,2,3.3);

Option A):
Constructor 2
Option B):
Constructor 4
Option C):
Constrcutor 1
Option D):
Type mismatch error

Correct Answer is Option B):
Constructor 4


Failure is the first step towards seccess.

2015-05-26 06:31:50

Advertisement
Ads By Google

Re: Constructor:



\n

Board footer