10 2018 档案

摘要:Noteworthy: 1 constructors of the derived class use member initializer list syntax to initialize base class private members: 2 A derived class method 阅读全文
posted @ 2018-10-25 09:07 Gabriel_Ham 阅读(149) 评论(0) 推荐(0)
摘要:class inheritance lets you derive new classes from old ones, inheriting its properties of the old class, called the base class With inheritance, you c 阅读全文
posted @ 2018-10-18 22:02 Gabriel_Ham 阅读(177) 评论(0) 推荐(0)
摘要:12.7 A queue simulation ) queue: FIFO(first in first out), just like regular queue in the waiting line ) stack: LIFO(last in first out), just like a p 阅读全文
posted @ 2018-10-18 09:57 Gabriel_Ham 阅读(118) 评论(0) 推荐(0)
摘要:12.3 Things to remember when using new in constructors ) If you use new in constructors, use delete in destructor. Their use should be compatible, pai 阅读全文
posted @ 2018-10-16 22:11 Gabriel_Ham 阅读(161) 评论(0) 推荐(0)
摘要:12.1 Dynamic memory and classes 12.1.1 A review example and static class members Now try implement a String class(a flawed one): // sayings1.cpp using 阅读全文
posted @ 2018-10-16 20:26 Gabriel_Ham 阅读(185) 评论(0) 推荐(0)
摘要:11.5.3 An implementation comment ) The separation of interface from implementation is one of the goals of OOP. ) Example of the implementation of the 阅读全文
posted @ 2018-10-16 11:13 Gabriel_Ham 阅读(162) 评论(0) 推荐(0)
摘要:11.1 Operator overloading ) Operator overloading is an example of C++ polymorphism. It allows you to extend operator overloading to user defined types 阅读全文
posted @ 2018-10-09 11:38 Gabriel_Ham 阅读(141) 评论(0) 推荐(0)
摘要:10.5 An array of objects ) You can define an array of objects just as an array of built in types: Declaring without initialization requires the class 阅读全文
posted @ 2018-10-07 20:58 Gabriel_Ham 阅读(149) 评论(0) 推荐(0)
摘要:10.2.4 Using classes Following exapmle uses the class definition and implementation written in previous files: ) The code below is a client: client : 阅读全文
posted @ 2018-10-07 17:48 Gabriel_Ham 阅读(164) 评论(0) 推荐(0)
摘要:10.1 Procedural and object oriented programming ) In procedural programming, you first concentrate on the procedures you will follow ) In OOP, you con 阅读全文
posted @ 2018-10-07 11:40 Gabriel_Ham 阅读(181) 评论(0) 推荐(0)
摘要:9.3 Namespaces namespace problems The conflict of using same name things from different libraries. For example, two libraries might both define classe 阅读全文
posted @ 2018-10-07 09:26 Gabriel_Ham 阅读(125) 评论(0) 推荐(0)
摘要:9.2.10 Storage schemes and dynamic allocation Memory allocated by new operator is called dynamic memory. Dynamic memory is controlled by new and delet 阅读全文
posted @ 2018-10-05 22:50 Gabriel_Ham 阅读(157) 评论(0) 推荐(0)
摘要:9.2.4 Static duration, external linkage ) External variables External variables are defined outside, thus external to any function.It is also termed g 阅读全文
posted @ 2018-10-05 21:12 Gabriel_Ham 阅读(205) 评论(0) 推荐(0)
摘要:10.10 查找列表 ) 线性查找 线性查找顺序地将关键字key与列表中的每一个元素进行比较,直到找到某个匹配元素时返回其下标,亦或在找不到时返回 1。代码如下: 若关键字存在,线性查找在找到关键字前平均需要查找一半的元素,其运行时间与列表中的元素个数成正比(时间复杂度为O(n)?)。这样的效率十分 阅读全文
posted @ 2018-10-04 15:06 Gabriel_Ham 阅读(242) 评论(0) 推荐(2)
摘要:10.3 实例研究:乐透数 编写程序决定输入数字是否涵盖了1 99之间的所有整数: 10.4 实例研究:一副扑克牌 在一副扑克牌中随机抽出四张并显示花色与数字: 10.5 扑克牌图形用户界面 给出一个图形用户界面,单机shuffle按钮,显示四张随机扑克牌的图像: 10.6 复制列表 想到复制列表时 阅读全文
posted @ 2018-10-04 10:41 Gabriel_Ham 阅读(258) 评论(0) 推荐(0)
摘要:10.1 引言 )Python提供一种称为 列表 的数据类型来存储一个有序的元素集合。Python中的列表(不像部分语言中的数组)大小可变。 10.2 列表基础 )创建列表 注意,python的列表中的元素可以是不同类型,如上例list5所示 )列表使用的操作与函数 操作|描述|操作|描述 |: : 阅读全文
posted @ 2018-10-04 09:31 Gabriel_Ham 阅读(248) 评论(0) 推荐(0)