#include <iostream>
using namespace std;
class Test {
public:
Test() : num(5) {}
void Print()
{
cout << "num is " << num << endl;
}
public:
const int num = 10;
};
int main() {
cout << "hello lddgo.net" << endl;
Test a;
a.Print();
return 0;
}
输出如下:
hello lddgo.net
num is 5