这回你该满意了吧?
#include
using namespace std;//加上使用名空间
class Sample
{
int A;
//ERROR *****found*******
static int B;//只声明不初始化
public:
Sample(int a){A = a;B += a;}
//ERROR *****found*******
static void func(Sample s)
{
cout<<"A="<
};
//ERROR *****found*******
int Sample::B=0;//在类外给静态变量初始化,不能直接在类中初始化
void main( )
{
Sample s1(2), s2(5);
Sample ::func(s1);
Sample ::func(s2);
}