0

OOPS IN C++

I have a doubt in OOPS when we create our own parametric constructuor of two input argument then after we create an object S1 with no argument given in his paranthesis then for S1 default constructor call or it shows error as no constructor of same type found.

21st Apr 2022, 2:01 AM
Naman Sharma
2 Réponses
+ 2
If you create a constructor, you do not get a default one. You can create your own, if desired.
21st Apr 2022, 2:21 AM
John Wells
John Wells - avatar
+ 2
class T { public: T() = default; T(int t) { cout << t; } };
21st Apr 2022, 2:24 AM
John Wells
John Wells - avatar