
C++
xaphoenix
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
C++ 01 —— 重载
C++明天考试,复习一波重载的作用域我们参考下C++primer上的例子string read();void print(const string&);void print(double);void fooBar(int ival){ bool read = false; string s = read(); void print(int); print("V原创 2017-06-10 22:18:22 · 1350 阅读 · 0 评论 -
C++ 13 —— 多重继承
源码// 13Inhe_Multiple.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"class Base1{public: void fun1(){}};class Base2{public: void fun2(原创 2017-06-11 00:40:14 · 391 阅读 · 0 评论 -
C++ 14 —— 私有继承
源码// 14Inhe_private.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"class Base{public: void fun1(){}};class Derived : Base//私有继承{};int ma原创 2017-06-11 00:46:59 · 424 阅读 · 0 评论 -
C++ 15 —— 多态
源码// 15Poly_Upcasting.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"class Pet{public: void Speak(){}};class Dog : public Pet{public:原创 2017-06-11 00:53:40 · 451 阅读 · 0 评论 -
C++ 16 —— 虚函数
源码// 16Poly_Virtual.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"class Pet{public: virtual void Speak(){}};class Dog : public Pet{publ原创 2017-06-11 16:54:51 · 447 阅读 · 0 评论 -
C++ 17 —— 纯虚函数
源码// 17Ploy_PureVirtual.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"class Pet{public: void Speak() = 0; //问题1. 对于Pet类,存在一个纯虚函数,那么Pet原创 2017-06-11 17:04:57 · 561 阅读 · 0 评论 -
C++ 18 —— 抽象类
源码// 18Poly_Interface.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"class FlyObject{public: virtual void Fly() = 0;};class Machine{};cla原创 2017-06-11 17:07:05 · 667 阅读 · 0 评论 -
C++ 19 —— 模板
源码 // 19Template.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"template <class T>class Stack{ int top; T pool[100];public: Stack(原创 2017-06-11 17:13:04 · 781 阅读 · 0 评论 -
C++ 20 —— STL
源码// 20STL.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"#include "vector"using namespace std;int main(int argc, char* argv[]){ vector<int原创 2017-06-11 17:15:29 · 621 阅读 · 0 评论 -
C++ 12 —— 初始化顺序
源码// 12Inhe_Init_list.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"class Base{protected: int i;public: Base(int ai):i(ai){}};class D原创 2017-06-11 00:27:31 · 417 阅读 · 0 评论 -
C++ 11 —— 继承
源码// 11Inhe_Concept.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"//考虑一个场景,图书馆有很多书(book),其中,很多事技术类现代书籍(TechBook),也有珍贵的历史文献(HisBook)//如果一本书丢了,都要进原创 2017-06-11 00:13:01 · 505 阅读 · 0 评论 -
C++ 10 —— 重载
源码// 10OpOverloading.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"class Account{ int balance;public: Account():balance(0){} void S原创 2017-06-11 00:11:32 · 450 阅读 · 0 评论 -
C++ 02 —— 访问权限
源码// 02AccessControl.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"class Test{//通常,将data member标注成private,外部不能访问//private可以省略,class内部默认为privat原创 2017-06-10 22:40:31 · 624 阅读 · 2 评论 -
C++ 03 —— this
源码// 03This.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"class Test{ int i; int j;public: void SetI(int ai) { cout <<原创 2017-06-10 22:48:27 · 355 阅读 · 0 评论 -
C++ 04 —— 构造函数
源码// 04Constructor.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"class Test{ int i; int j;public: //class 内部,默认存在一个构造函数,形如以下,但是,一旦人原创 2017-06-10 23:17:50 · 393 阅读 · 0 评论 -
C++ 05 —— 析构函数
源码// 05Destructor.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"class Test{ int i; int *p;public: Test(int ai) { i = ai原创 2017-06-10 23:25:02 · 629 阅读 · 3 评论 -
C++ 06 —— 拷贝构造函数
源码// 06CopyConstructor.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"class Test{ int i; int *p;public: Test(int ai,int value) {原创 2017-06-10 23:37:23 · 445 阅读 · 0 评论 -
C++ 07 —— static
源码// 07Static.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"//1. static local varclass Test{public: Test() { cout << "construc原创 2017-06-10 23:49:06 · 404 阅读 · 0 评论 -
C++ 08 —— Const
源码// 08Const.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"//1. const & parametervoid fun(int* p1,const int* p2){}//问题:两个参数暗含什么含义?//2. const fu原创 2017-06-10 23:57:39 · 411 阅读 · 0 评论 -
C++ 09 —— NewDelete
源码// 09NewDelete.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"#include "stdlib.h"class Test{ int *p;public: Test() { p =原创 2017-06-11 00:04:50 · 410 阅读 · 0 评论 -
C++ 21 —— 异常
源码// 21Exceptions.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"//exception: 程序运行过程中,由于资源、环境等变化导致的不可预知因素//注意. bug不是exception,exception是程序员不可控制的,原创 2017-06-11 17:17:22 · 476 阅读 · 0 评论