有关静态数据输出的问题
#include <iostream>using namespace std;
class Sample
{
private:
int x;
static long p;
public:
Sample(int a)
{
x=a;
p*=x;
}
static void print(Sample s)
{
cout<<"x="<<x<<",p="<<p<<endl;
}
};
void main()
{
Sample s1(10);
Sample s2(15);
Sample::print(s1);
Sample::print(s2);
}