自考新教材-p87_3

源程序:

#include <iostream>
using namespace std;
class A
{
public:
int a, b;
private:
int c, d;
public:
int getc();
};
int A::getc()
{
return c;
}
int main()
{
A onea;
cout << "onea.a" << "," << onea.getc() << endl;
system("pause");
return 1;
}

运行结果:

原文地址:https://www.cnblogs.com/duanqibo/p/12268702.html