普通成员函数不属于类
程序代码:#include <malloc.h>
#include <stdio.h>
#include <string.h>
class stub
{
public :
int test1(int a) { return a; }
static int test2(int a) { return a; }
};
int main(int argc,char** argv)
{
class stub *tmp = new stub;
printf("value = %d\n", tmp->test1(4));
printf("value = %d\n", stub::test2(4));
delete tmp;
return 0;
}printf("value = %d\n", stub::test(4));错误,只能使用printf("value = %d\n", tmp->test(4));说明普通成员函数不属于类,静态成员函数才属于类!








