0

I have just started cpp. Can i get an example of program using constructor by someone

15th Aug 2019, 2:32 PM
Mohit Hambire
2 odpowiedzi
+ 2
class A { public: int x; A() { x = 39; } }; int main() { A obj; // constructor called std::cout << obj.x; // prints 39 }
15th Aug 2019, 2:36 PM
Hatsy Rei
Hatsy Rei - avatar
+ 1
Thanx Hatsy Rei
15th Aug 2019, 2:39 PM
Mohit Hambire