首页 > 其他 > 详细

静态函数调用非静态函数的小样例

时间:2017-08-08 10:42:27      阅读:132      评论:0      收藏:0      [点我收藏+]
// tt.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"

class A
{
public:
	void fun()
	{
		printf("1111111111");
	}

	static void fun2()
	{
		fun();
	}
};

int _tmain(int argc, _TCHAR* argv[])
{
	A a;
	A::fun2();

	return 0;
}

技术分享


// tt.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"

class A
{
public:
	void fun()
	{
		printf("1111111111");
	}

	static void fun2(A a)
	{
		a.fun();
	}
};

int _tmain(int argc, _TCHAR* argv[])
{
	A a;
	A::fun2(a);

	return 0;
}



静态函数调用非静态函数的小样例

原文:http://www.cnblogs.com/mfmdaoyou/p/7305113.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!