10 2022 档案

摘要:template 声明 ​ 当我们声明一个template class、template class memberfunction等,会发生何事? ​ 现有如下片段: template <class Type> class Point { public: enum Status{ unallocat 阅读全文
posted @ 2022-10-25 19:36 爱莉希雅 阅读(37) 评论(0) 推荐(0) 编辑
摘要:obejct construction and destruction ​ 一般而言,constructor和destructor的安插都如预期那样: { Point point; //point.Point::Point() 安插于此 ... //point.Point::~Point() 安插于 阅读全文
posted @ 2022-10-24 21:46 爱莉希雅 阅读(47) 评论(0) 推荐(0) 编辑
摘要:抽象基类 ​ 现有如下代码: class Abstract_base { public: virtual ~Abstract_base() = 0; virtual void interface() const = 0; virtual const char* mumble() const { re 阅读全文
posted @ 2022-10-23 13:13 爱莉希雅 阅读(102) 评论(0) 推荐(0) 编辑
摘要:member functions的调用方式 c++支持三种类型的member functions:static、nonstatic、virtual,且每一种调用方式不尽相同 nonstatic member functions nonstatic member function至少和nonmembe 阅读全文
posted @ 2022-10-21 17:14 爱莉希雅 阅读(59) 评论(0) 推荐(0) 编辑
摘要:class object layout //64位系统 class A{ }; //sizeof(A)为1 class B : virtual public A{ }; //sizeof(B)为8 class C : virtual public A{ }; //sizeof(C)为8 class 阅读全文
posted @ 2022-10-19 17:02 爱莉希雅 阅读(88) 评论(0) 推荐(0) 编辑
摘要:default constructor default constructor只有在被编译器需要时,才会被合成出来,且合成出的constructor只执行编译器所需要的行动(并不对成员初始化) 含有default constructor的member class object 在c++各个不同的编译 阅读全文
posted @ 2022-10-16 18:42 爱莉希雅 阅读(81) 评论(0) 推荐(0) 编辑
摘要:C语言中,数据与处理数据的操作(函数)是分开声明的,这种程序方法被称为程序性的;而在c++中,则是使用abstract data type(ADT)或class hierarchy的数据封装 c++对于结构体和函数(不包含virtual和non-inline)的封装并没有增加布局成本,对于C++而言 阅读全文
posted @ 2022-10-12 17:45 爱莉希雅 阅读(157) 评论(0) 推荐(0) 编辑