c++ 16 this 和 继承 及继承机制中的构造函数 与 析构函数
#include <iostream>
#include <string>
using namespace std; class Animal
{
public:
Animal();
Animal(string name);
string mouth;
void eat();
void sleep();
void drool();
string name;
}; class Pig : public Animal
{
public:
Pig();
Pig(string name);
void climb();
}; class Turtle : public Animal
{
public:
Turtle();
Turtle(string name);
void swim();
}; Animal::Animal()
{
cout << "父类的构造函数先调用" << endl;
this->name = "NULL ";
}
Animal::Animal(string name){
this->name = name;
} void Animal::eat()
{
cout << name << "I am eating " << endl;
} void Animal::sleep()
{
cout << name << "I am sleeping , don't disturb me " << endl;
} void Animal::drool()
{
cout << name << " i am female , when i look male , i will flow water" << endl;
} Pig::Pig(){
cout << name << "子类Pig的构造器后被调用" << endl;
} Pig::Pig(string name) : Animal(name) //继承了子类的构造器 :
{
cout << name << "子类Pig的构造器后被调用" << endl;
} void Pig::climb()
{
cout << name << " 我是一个漂亮的母猪, 我会上树, 我正在上树" << endl;
} Turtle::Turtle(){
cout << "子类Turtle的构造器后被调用" << endl;
} Turtle::Turtle(string name) : Animal(name) //继承了子类的构造函数 :
{
cout << "子类Turtle的构造器后被调用" << endl;
} void Turtle::swim()
{
cout << "我是一只小甲鱼,当母猪要来抓我的时候,我就游到海里。。 哈哈" << endl;
} int main()
{
Pig pig("亨利");
Turtle turtle("龟仙人"); pig.eat();
turtle.eat();
pig.climb();
turtle.swim(); return ;
}
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeMAAABTCAIAAAAjqPiuAAATzklEQVR4nO1d2YHrIAxMXRREPVRDMxST94EBSUgcjr3x2535SmKQOQchhPJ6UbiQ3tG/7oeP7xTc+u93vvO2t/1MU57Cz7bFk/DsfgH+S/j4VnHVQPPx/ea/uJDqW26cyS4koxY3MsiPrUIZz2YEMDUAACroKmDOlesZhCx3PzpBn80IYGoA+B3wcXsqO+9FDh8upQPvz08xHze3CX1thuJFTV0I/w8dGFW9uPcAALgDto2iS3XYS2JMPL20ODC9WoFCpT42bZiwLf15Cd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ElFTkSuQmCC" alt="" />
#include <iostream>
#include <string>
using namespace std; class BaseClass
{
public:
BaseClass();
~BaseClass();
void dosth();
}; class SubClass : public BaseClass
{
public:
SubClass();
~SubClass();
}; BaseClass::BaseClass()
{
cout << "进入基类构造器" << endl;
cout << "我在基类构造器干了些事" << endl;
} BaseClass::~BaseClass()
{
cout << "进入基类析构器" << endl;
cout << "我在基类的析构器干了些事" << endl;
} void BaseClass::dosth()
{
cout << "我干了些事" << endl;
} SubClass::SubClass()
{
cout << "进入子类构造器" << endl;
cout << "我在子类构造器干了些事" << endl;
} SubClass::~SubClass()
{
cout << "进入子类析构器" << endl;
cout << "我在子类的析构器干了些事" << endl;
} int main()
{
SubClass sub; sub.dosth(); cout << "程序运行结束" << endl; return ; }
/* vim: set ts=4 sw=4 sts=4 tw=100 */
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAANIAAACFCAIAAAChcDFaAAAM3UlEQVR4nO1d3bW0Kgw9dVEQa33dUMKtgmYoZu6DgkkIARTFn+ync2YcRN0kgWzD33///ffv37+/C2Fc+CV4yx9k/S84M/K01ldPegqsv/iEXRh/n9twPe02GIMv2FjbdgesrT5H6/DdNM7d9tl/ECzt6BjYRqw4dleD0jy26WmMC+sHlJCx8bVp63/xl/Bjejj4eDGxhZ4ZF2A/VoZKhgBZ7OUwYE1/cyzIk1CydtaDh2R9vI/bX2Wgn/Lfp8fjPXx+6YMQAtdEbDn2wjj2sL/sK0KsjNfGhdRn48Lv5+12qdZnJ9laT3+lw4VOKSJEJ4sHNUH53rYGDJTDGTmqfWA6hKzO+rH1wVnaTqGLC8lgK95mxKvQTo1dDU2xXb+187mFYA+kqLW+PFPrgzObS+aPi+PCWJ+FdUWDDAgmXapxPoTY4djYOkCUcw2gtGMnfD20Wwd7Gz8brB36en2m0LKwdI2fe/tnnbcG/ni9ys1apet1smEtEfXnbZrjLHEhiD0VLArWzrjgrezf+PuaHmghxGn3maD95UfCgyRe0DjvffB2c/eE4Zm1A99n82ncO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p9lCQCYn2ykFeFBq/4uYUBUArhyhjPL2QQhiBTqtCvB0zKwKwOTE2GlnNQQGHXpCal8xtSrAjretmqQAfzdP7SumVgVosnboa60K8BLcsioAbb9TCnCn1L6CxcSqAMmxxQNx5mNtf48U4OapfcW0qgCQkyhRRPy7VgV4Ja6vCpCWxPj88pY6YturSgEekNpXXF4VgNPHNAtQGqUA60lvm9pXTKgK0Kzgyo9ulAKsn942ta9QKYBiBmZWBThTCtC7gqHSgXY8tirAgjOlAMw0WowHHiQd0KoAbJfYGIlfgDhPCqBVAeBVaVUA9MvxUoDUI60KoFUBeJwlBdCqAFoVQMBZUgCtCqBVAYgZu0IKoFUBtCqAePUnSQG0KkBTbBq+VxXgPCkAF9sRkMnS3aUDQ2lXAbeoVUf3VPb6qgAnSwH+GmiHOHZ/6cAJtCv6cv/OqgBXSAEKThb+LnecN5YOXGntYgPSCQeIHa6vCnC+FECrAgjHt9z+oFUBFG8ETzs4JI7a07uhI2n8HnRkXC9pv0y7M3s5E8dpx2etd6Do9Ye/knEz2v0Pli/lWZ/JxoYAAAAASUVORK5CYII=" alt="" />
c++ 16 this 和 继承 及继承机制中的构造函数 与 析构函数的更多相关文章
- C++类继承中的构造函数和析构函数 调用顺序
思想: 在C++的类继承中,构造函数不能被继承(C11中可以被继承,但仅仅是写起来方便,不是真正的继承) 建立对象时,首先调用基类的构造函数,然后在调用下一个派生类的构造函数,依次类推: 析构对象时, ...
- (C++)C++类继承中的构造函数和析构函数
思想: 在C++的类继承中, 建立对象时,首先调用基类的构造函数,然后在调用下一个派生类的构造函数,依次类推: 析构对象时,其顺序正好与构造相反: 例子: #include <iostream& ...
- C++中的类继承(4)继承种类之单继承&多继承&菱形继承
单继承是一般的单一继承,一个子类只 有一个直接父类时称这个继承关系为单继承.这种关系比较简单是一对一的关系: 多继承是指 一个子类有两个或以上直接父类时称这个继承关系为多继承.这种继承方式使一个子类可 ...
- EffectiveJava(16)复合优先于继承
为什么复合优先于继承? 1.继承违反了封装原则,打破了封装性 2.继承会不必要的暴露API细节,称为隐患.比如通过直接访问底层使p.getProperty(K,V)的键值对可以不是String类型 3 ...
- C++中的类继承之单继承&多继承&菱形继承
C++中的类继承之单继承&多继承&菱形继承 单继承是一般的单一继承,一个子类只 有一个直接父类时称这个继承关系为单继承.这种关系比较简单是一对一的关系: 多继承是指 一个子类有两个或 ...
- C++学习之路—继承与派生(二):派生类的构造函数与析构函数
(根据<C++程序设计>(谭浩强)整理,整理者:华科小涛,@http://www.cnblogs.com/hust-ghtao转载请注明) 由于基类的构造函数和析构函数是不能被继承的,所以 ...
- C#面向对象(OOP)入门—第二天—多态和继承(继承)
介绍: 第一天的内容主要是不同情形下的方法重载.这一部分则主要讲面向对象中继承的概念.首先用一个要点图形来定义继承. 继承 一个简单的例子: ClassA: class ClassA:ClassB { ...
- CSS中的层叠、特殊性、继承、样式表中的@import
CSS中的层叠.特殊性.继承.样式表中的@import 层叠 CSS有一个机制是层叠,层叠可以理解为对样式的覆盖,优先性为: 网站开发者的样式表 用户样式(通过设置浏览器的显示选项) 浏览器默认的样式 ...
- C++类中的一些细节(重载、重写、覆盖、隐藏,构造函数、析构函数、拷贝构造函数、赋值函数在继承时的一些问题)
1 函数的重载.重写(重定义).函数覆盖及隐藏 其实函数重载与函数重写.函数覆盖和函数隐藏不是一个层面上的概念.前者是同一个类内,或者同一个函数作用域内,同名不同参数列表的函数之间的关系.而后三者是基 ...
随机推荐
- ActiveMQ(5.10.0) - Configuring the Simple Authentication Plug-in
The easiest way to secure the broker is through the use of authentication credentials placed directl ...
- Spring(3.2.3) - Beans(10): 生命周期
Spring 容器可以管理 singleton 作用域 Bean 的生命周期,容器能够跟踪 Bean 实例的创建.销毁.管理 Bean 生命周期行为主要有两个时机: 注入 Bean 的依赖关系之后 即 ...
- winform 渐变(非API)
public FrmMain() { InitializeComponent(); //窗体显示特效 Opacity = 0.0; //窗体透明度为0 fadeTimer.Start(); //计时开 ...
- Cocos移植到Android-Android.mk编译文件
我们在上一篇博客中年使用的cocos工具对于C和C++源代码进行编译.事实上cocos工具读取<游戏工程目录>\proj.android\jni\目录中的Android.mk文件,进行交叉 ...
- 基于asp.net的Web开发架构探索
问题由来 最近在研究适合团队开发的web架构解决方案,该架构即要适合分工协作又要有一定扩展性,适合不同的数据库需要,因此我查阅了一些资料,初步构想出了一套架构,请各位多多指教. 探索 web开发架构最 ...
- 抽象类[abstract]_C#
抽象类(abstract) abstract修饰符可以和类.方法.属性.索引器及事件一起使用.在类声明中使用abstract修饰符以指示某个类只能是其它类的基类.标记为抽象或包含在抽象类中的成员必须通 ...
- ASP.NET MVC3 使用kindeditor编辑器获取不到值
做开发真的是会遇到各种问题,如果不亲自尝试,不动手,很难发现问题. 下面我们说下在MVC中的用法 1,首先引入js文件 <script type="text/javascript&qu ...
- 暑假集训(4)第八弹——— 组合(hdu1524)
题意概括:你已经赢得两局,最后一局是N个棋子往后移动,最后一个无法移动的玩家失败. 题目分析:有向无环图sg值游戏,尼姆游戏的抽象表达.得到每个棋子的sg值之后,把他们异或起来,考察异或值是否为0. ...
- C++与Lua交互(一)
引言 之前做手游项目时,客户端用lua做脚本,基本所有游戏逻辑都用它完成,玩起来有点不爽,感觉"太重"了.而我又比较偏服务端这边(仅有C++),所以热情不高.最近,加入了一个端游项 ...
- iOS 非ARC基本内存管理系列 2-多对象内存管理(3) 利用@property来自动管理内存
iOS 基本内存管理-多对象内存管理(2)中可以看到涉及到对象的引用都要手动管理内存:每个对象都需要写如下代码 // 1.对要传入的"新车"对象car和目前Person类对象所拥有 ...