OOPS
August 25, 2024UML
August 25, 2024OOPS
Question 125 |
Which constructor will be called by the following lines of code?
(i) Student S1;
(ii) Student S2=S1;
(i) Student S1;
(ii) Student S2=S1;
First copy constructor, then default constructor | |
First default constructor, then copy constructor | |
Default constructor for both lines of code | |
Copy constructor for both lines of code |
Question 125 Explanation:
→ Student S1:—-whenever we create object to the class , automatically default constructor will be called.
→ Student S2=S1:——The copy constructor is a constructor which creates an object by initializing it with an object of the same class, which has been created previously.
→ Student S2=S1:——The copy constructor is a constructor which creates an object by initializing it with an object of the same class, which has been created previously.
Correct Answer: B
Question 125 Explanation:
→ Student S1:—-whenever we create object to the class , automatically default constructor will be called.
→ Student S2=S1:——The copy constructor is a constructor which creates an object by initializing it with an object of the same class, which has been created previously.
→ Student S2=S1:——The copy constructor is a constructor which creates an object by initializing it with an object of the same class, which has been created previously.