C++
飞奔的六六
这个作者很懒,什么都没留下…
展开
-
【C++】运算符重载(eg:复数运算)
Complex.h#include<iostream>using namespace std;class Complex {public: Complex(double real = 0.0, double image = 0.0) { this->real = real; this->image = image; } ~Complex(...原创 2019-05-23 11:22:50 · 331 阅读 · 0 评论 -
【C++】函数模板和类模板
My_tools.h#include<iostream>using namespace std;template <class T> T My_min(T t1, T t2);template <typename T>T My_max(T t1, T t2);template <class T>void Swap(T t1...原创 2019-05-23 17:16:59 · 207 阅读 · 0 评论 -
【C++】基类指针遍历派生类数组调用子类函数
#include<iostream>using namespace std;class A {public: virtual void abc() { cout << " A. " << endl; }};class B : public A {public: void abc() { cout <&...原创 2019-05-23 20:00:43 · 1848 阅读 · 0 评论