#include <iostream>
using namespace std;
class MyClass{
public:
MyClass();
~MyClass();
private:
string myName;
string myNote;
};
//Constructor with initializer list
MyClass::MyClass()
:myName("initName"), myNote("initNote")
{
cout << "MyClass Constructor: " << myName << endl;
}
MyClass::~MyClass(){
cout << "MyClass Destructor: " << myName << endl;
}
int main()
{
MyClass myClass1;
return 0;
}
No comments:
Post a Comment