Syntax not clear
Title
Question
Dear Sir/Ma'am,
What if in the same code, instead of creating the object as "Substraction s", I create the object like "Substraction s()"
Regards,
Abu.
Advanced-Cpp Constructor-And-Destructor 04-05 min 30-40 sec
Answers:
Writing Substraction s; correctly creates an object named s.
But writing Substraction s(); doesn’t create an object — it declares a function named s that returns a Substraction object (known as the Most Vexing Parse in C++).
So always use Substraction s; to create the object properly.
Login to add comment