How to stop obj getting created | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to stop obj getting created

I want to disable obj being created in below code Is there a way apart from setting one param constructor marked as delete ? This delete way would work but then i have to define two param constructor for other obj2 to work , which i dont dont to do.. https://code.sololearn.com/cpR4bR8CEsfR/?ref=app

23rd Oct 2022, 5:36 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
3 Answers
+ 4
Im not sure what you're asking about... is this qhat you're looking for? : https://code.sololearn.com/c1hphz3hT1Bn/?ref=app
24th Oct 2022, 3:52 AM
Prashanth Kumar
Prashanth Kumar - avatar
+ 1
Could not get you
24th Oct 2022, 3:47 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 1
Partially yes I want compile time error for obj creation and thats there But to achieve so, i had to define constructor taking two arguments so that obj1 work... Is there other way to get compile time error for obj but i dont have to define any constructors for 2 parameeters
24th Oct 2022, 3:59 AM
Ketan Lalcheta
Ketan Lalcheta - avatar