`

接口的构造函数是否被调用~~

 
阅读更多

// TestDev.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;

class A
{
public:
	A()
	{
		cout << "A::A()" << endl;
	}

	~A()
	{
		cout << "A::~A()" << endl;
	}

public:
	virtual void fun() = 0;
};

class B:public A
{
public:
	B()
	{
		cout << "B::B" << endl;
	}

	~B()
	{
		cout << "B::~B" << endl;
	}

public:
	virtual void fun()
	{
		cout << "B::fun()" << endl;
	}
};

int _tmain(int argc, _TCHAR* argv[])
{
	B b;

	b.fun();

	return 0;
}
 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics