2020年3月14日
摘要: #include<iostream> using namespace std; class Date; class Time{ public: Time(int, int, int); void display(const Date&); private: int hour,minute,secon 阅读全文
posted @ 2020-03-14 17:20 ~明月几时有 阅读(212) 评论(0) 推荐(0)
摘要: #include<iostream> using namespace std; class Point{ public: Point(float=0,float=0); void setPoint(float,float); float getX()const{return x;} float ge 阅读全文
posted @ 2020-03-14 09:58 ~明月几时有 阅读(607) 评论(0) 推荐(0)
  2020年3月13日
摘要: #include<iostream> using namespace std; #define ElemType int const int MaxSize=100; typedef struct{ ElemType data[MaxSize]; int length=0; }SqList; //插 阅读全文
posted @ 2020-03-13 22:14 ~明月几时有 阅读(270) 评论(0) 推荐(0)
摘要: #include<iostream> using namespace std; #define ElemType int typedef struct LNode{ ElemType data; struct LNode *next; }LNode,*LinkList; bool GetElem(L 阅读全文
posted @ 2020-03-13 22:12 ~明月几时有 阅读(140) 评论(0) 推荐(0)
摘要: 虚函数的工作原理: 一、为每一个包含虚函数的类建立一个虚函数表,表中的每一项存放的是虚函数在内存中的入口地址 二、在该类的每个对象中设置一个指向虚函数表的指针,在调用虚函数时,通过虚指针找到虚函数表,找出虚函数的入口地址在表中的位置,获取入口地址完成调用 三、虚函数表是一个类的所有对象共享,所有对象 阅读全文
posted @ 2020-03-13 21:54 ~明月几时有 阅读(309) 评论(0) 推荐(0)
摘要: #include<iostream> using namespace std; class MyInteger { public: MyInteger() { m_Num = 0; } //重载前置递增运算符 MyInteger& operator++() { m_Num++; return *th 阅读全文
posted @ 2020-03-13 21:27 ~明月几时有 阅读(326) 评论(0) 推荐(0)
摘要: #include<iostream> #include<string> using namespace std; class Animal { public: Animal() { cout << "Animal 构造" << endl; } /*virtual ~Animal() { cout < 阅读全文
posted @ 2020-03-13 21:13 ~明月几时有 阅读(199) 评论(0) 推荐(0)
摘要: #include<iostream> using namespace std; class Base { public: virtual void func() = 0; }; class Son :public Base { public: virtual void func() { cout < 阅读全文
posted @ 2020-03-13 20:52 ~明月几时有 阅读(137) 评论(0) 推荐(0)
摘要: #include<iostream> using namespace std; class Base { public: Base() { cout << "Base的构造函数" << endl; } ~Base() { cout << "Base的析构函数" << endl; } }; class 阅读全文
posted @ 2020-03-13 20:44 ~明月几时有 阅读(315) 评论(0) 推荐(0)
摘要: #include<iostream> using namespace std; class Person { public: void show() const { m_B = 200;//成员属性声明时加关键字mutable,在常函数内可以修改 //m_A = 100;报错,常函数内不允许修改成员 阅读全文
posted @ 2020-03-13 20:38 ~明月几时有 阅读(289) 评论(0) 推荐(0)