Files
CPP/OOP/constructor/constructor.cpp
2025-04-29 21:21:54 +02:00

20 lines
383 B
C++

#include <iostream>
/*
Here we have a example of a Constructor ;
When we create a Class Object we auto-call the Constructor
*/
using namespace std;
class MyClass {
public:
MyClass() { // This is the constructor!
cout << "Construct!";
}
};
int main() {
MyClass classobj; // When we create this the Constructor autocalls!
return 0;
}