0
I have just started cpp. Can i get an example of program using constructor by someone
2 Answers
+ 2
class A {
public:
int x;
A() { x = 39; }
};
int main() {
A obj; // constructor called
std::cout << obj.x;
// prints 39
}
+ 1
Thanx Hatsy Rei