728x90
반응형
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// overring.cpp | |
// simple overriding example | |
#include <iostream> | |
using namespace std; | |
class A | |
{ | |
public: | |
A() { cout << "A()" << endl; } | |
~A() { cout << "~A()" << endl; } | |
}; | |
class B : public A | |
{ | |
public: | |
B() { cout << "B()" << endl; } | |
~B() { cout << "~B()" << endl; } | |
}; | |
int main(int argc, char *argv[]) | |
{ | |
B b; | |
// B *pb = new B(); | |
// delete pb; | |
return 0; | |
} | |
// console output: | |
// A() | |
// B() | |
// ~B() | |
// ~A() | |
728x90
반응형
'C C++' 카테고리의 다른 글
Creating and using Sprite Sheets in Cocos2D-X with Texture Packer (0) | 2012.12.07 |
---|---|
Using Spritesheets with Cocos2d-X (0) | 2012.12.07 |
Qt Polymorphism (0) | 2012.03.06 |
CStdString : 윈도우즈 문자열 클래스 (0) | 2012.02.27 |
[ FUNNY CODE ][runtime error] 초기화 실패 (0) | 2011.10.06 |