读程序写结果_1
源程序:
#include <iostream>
using namespace std;
class example
{
private:
int a;
public:
example(int b=5)
{
a=b++;
}
void print()
{
a=a+1;
cout<<a<<" ";
}
void print() const
{
cout<<a<<endl;
}
};
void main()
{
example x;
const example y(2);
x.print();
y.print();
}
运行结果:


浙公网安备 33010602011771号