How do we define a constructor when class name is x
Answers
Answered by
2
Constructors initialize values to object members after storage is allocated to the object. class A { into x; public: A(); //Constructor }; While defining a constructor you must remember that the name of constructor will be same as the name of the class, and constructors never have return type.
Similar questions
Political Science,
7 months ago
Math,
7 months ago
Hindi,
7 months ago
Math,
1 year ago
Psychology,
1 year ago
Math,
1 year ago
Science,
1 year ago