A* obj=new C(); obj->fun(); class C:public B { private: virtual fun()

原创 2012年03月26日 20:44:35
// tmpDerive.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
class A
{
public:
	virtual fun()
	{
		printf("A!\n");
	}
};
class B:public A
{
protected:
	virtual fun()
	{
		printf("B!\n");
	}
};

class C:public B
{
private:
	virtual fun()
	{
		printf("C!\n");
	}
};

class A1
{
private:
	virtual fun()
	{
		printf("A1!\n");
	}
};
class B1:public A1
{
protected:
	virtual fun()
	{
		printf("B1!\n");
	}
};

class C1:public B1
{
public:
	virtual fun()
	{
		printf("C1!\n");
	}
};
int main(int argc, char* argv[])
{
	A* obj=new C();
	obj->fun();
	C1* pobjC1=new C1();
	A1* obj1=pobjC1;
	printf("%p;%p\n",pobjC1,obj1);
	reinterpret_cast<C1*>(obj1)->fun();
	static_cast<C1*>(obj1)->fun();
	//obj1->fun();

	printf("Hello World!\n");
	return 0;
}

版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

OBJ-C内存管理+@property参数+@class+autorelease学习笔记

========================================================================                      ...

obj-c2.0大全

  • 2013-07-22 09:54
  • 1.95MB
  • 下载

codeforces 372C Watching Fireworks is Fun 单调队列优化dp

题意:一个城镇有n个区域,

OBJ-C book.

  • 2010-11-30 12:10
  • 385KB
  • 下载

obj-c 入门教程

  • 2009-02-10 10:52
  • 1.20MB
  • 下载

Codeforces 373C:Counting Kangaroos is Fun(二分+贪心)

C. Counting Kangaroos is Fun time limit per test 1 second memory limit per test 256 mega...

Obj-C高级编程

  • 2015-08-03 13:42
  • 22.73MB
  • 下载

Codeforces #219 (Div. 2) C. Counting Kangaroos is Fun

C. Counting Kangaroos is Fun time limit per test 1 second memory limit per test 256 mega...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)