![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++ 学习记录
Pancwyz
迷茫学习中...
展开
-
C++ 之 对象的实现
people.h#include class People{public: void sayHello(){} People(){}};people.cpp原创 2014-08-04 19:33:36 · 486 阅读 · 0 评论 -
C++ 之 命名空间
当引用多个库,多个ku原创 2014-08-04 19:47:54 · 483 阅读 · 0 评论 -
C++ 之 构造函数、析构函数
#include class Object {public: Object(){ //定义构造函数 printf("Create Object. \n"); }; ~Object(){ //定义析构函数 printf("Delete Object. \n"); }};int main(){ Object * o = new Object(); system("原创 2014-08-04 20:13:32 · 552 阅读 · 0 评论 -
C++ 之 伪函数
#include using namespace std;class Say{public: void operator()(){ //重载()符号 printf("hello ()"); }};int main(){ Say s; s(); //像函数一样调用,其实是一个类 system("pause"); return 0;}原创 2014-08-11 10:05:33 · 691 阅读 · 0 评论 -
C++ 之 虚函数、纯虚函数
#include #include class people{public: void say(){ printf("hello people.\n"); }};class man:public people{public: void say(){ printf("hello man.\n"); }};int main(){ people * p =原创 2014-08-11 09:33:55 · 496 阅读 · 0 评论 -
C++ 之 运算符重载
#include using namespace std;class point{private: int a,b;public: point(int a, int b){ //构造方法 this->a = a; this->b = b; } int getA(){ return this->a; } int getB(){ return this->b原创 2014-08-11 10:01:05 · 443 阅读 · 0 评论 -
C++ 之 部分容器的使用
#include #include #include #include using namespace std;int main(){ /********* list ********/ list lis; lis.push_back("hello"); lis.push_back("world"); for (auto it = lis.begin(); it!=l原创 2014-08-11 14:04:49 · 454 阅读 · 0 评论 -
C++ 之 虚函数、多态
一共三个文件 main.cpp Person.h Person.cpp原创 2014-09-15 18:05:19 · 574 阅读 · 0 评论 -
C++ 之 函数指针
void say(int x, int y){ cout << x << y << endl;}int main(){ void (*func)(int,int); //func = say; //都可以 func = &say; (*func)(1,1); func(1,1); system("pause"); return 0;}原创 2014-10-11 22:39:26 · 477 阅读 · 0 评论