20 lines
383 B
C++
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;
|
|
} |