+ 1

Explain me this statement :- MyClass :: MyClass ( ) { }

Source and Header

24th Jun 2021, 7:55 AM
Rgodella
Rgodella - avatar
2 Réponses
0
Myclass() is default constructor of your class Myclass. The expression u have written Myclass::Myclass(){} is the implementation of default constructor outside of the class declaration, Myclass:: indicates that Myclass() is the member of class Myclass. If u implement it inside class declaration, then there is no need to write Myclass::
25th Jun 2021, 3:58 AM
saurabh
saurabh - avatar
0
This is a constructor for the class, MyClass, which is declared inside the class but defined outside the class.
24th Jun 2021, 8:09 AM
Arun Bhattacharya
Arun Bhattacharya - avatar