上一页 1 ··· 41 42 43 44 45 46 47 48 49 ··· 51 下一页
摘要: 1.类里有重载函数调用符号的类实例化的对象也叫仿函数 2.仿函数的作用:1.方便代码维护 2.方便有权限的调用函数。3.作为算法的策略 程序1: #pragma warning(disable:4996) #include <iostream> using namespace std; class 阅读全文
posted @ 2022-10-14 20:13 CodeMagicianT 阅读(36) 评论(0) 推荐(0)
摘要: 1.智能指针类是管理另一个类的对象的释放 class Maker { public: Maker() { cout << "无参构造" << endl; } void printMaker() { cout << "hello Maker" << endl; } ~Maker() { cout << 阅读全文
posted @ 2022-10-14 18:50 CodeMagicianT 阅读(49) 评论(0) 推荐(0)
摘要: 程序1: 11数组下标重载.cpp #pragma warning(disable:4996) #include <iostream> using namespace std; #include "MyArray.h" void test() { MyArray arr; for( int i = 阅读全文
posted @ 2022-10-13 20:40 CodeMagicianT 阅读(43) 评论(0) 推荐(0)
摘要: 有的时候在VS中遇到的error C1083: 无法打开**: “ * .*”: No such file or directory的错误,这里总结了我遇到过的情况: 错误 C1083 无法打开包括文件: “MyArray.h”: No such file or directory 1.第一种情况: 阅读全文
posted @ 2022-10-13 19:58 CodeMagicianT 阅读(856) 评论(0) 推荐(0)
摘要: 1.前置和后置(++/--)运算符重载 重载的++和--运算符有点让人不知所措,因为我们总是希望能根据它们出现在所作用对象的前面还是后面来调用不同的函数。解决办法很简单,例如当编译器看到++a(前置++),它就调用operator++(a),当编译器看到a++(后置++),它就会去调用operato 阅读全文
posted @ 2022-10-13 14:32 CodeMagicianT 阅读(78) 评论(0) 推荐(0)
摘要: 程序1: #pragma warning(disable:4996) //2022年10月12日21:26:43 #include <iostream> using namespace std; class Maker { public: Maker() { id = 0; age = 0; } M 阅读全文
posted @ 2022-10-12 21:38 CodeMagicianT 阅读(46) 评论(0) 推荐(0)
摘要: 1.赋值(=)运算符重载 赋值符常常初学者的混淆。这是毫无疑问的,因为’=’在编程中是最基本的运算符,可以进行赋值操作,也能引起拷贝构造函数的调用。 class Person{ friend ostream& operator<<(ostream& os,const Person& person){ 阅读全文
posted @ 2022-10-12 21:04 CodeMagicianT 阅读(74) 评论(0) 推荐(0)
摘要: 1.视频内容 程序1: #pragma warning(disable:4996) #include <iostream> using namespace std; void test() { int a; cin >> a; cout << a << endl; } class Maker { f 阅读全文
posted @ 2022-10-05 22:23 CodeMagicianT 阅读(50) 评论(0) 推荐(0)
摘要: 1.视频内容 程序1: #pragma warning(disable:4996) //2022年10月5日21:11:12 #include <iostream> using namespace std; class Maker { public: Maker(int id, string nam 阅读全文
posted @ 2022-10-05 22:22 CodeMagicianT 阅读(63) 评论(0) 推荐(0)
摘要: 1.前置和后置(++/--)运算符重载 重载的++和--运算符有点让人不知所措,因为我们总是希望能根据它们出现在所作用对象的前面还是后面来调用不同的函数。解决办法很简单,例如当编译器看到++a(前置++),它就调用operator++(a),当编译器看到a++(后置++),它就会去调用operato 阅读全文
posted @ 2022-10-05 21:09 CodeMagicianT 阅读(90) 评论(0) 推荐(0)
上一页 1 ··· 41 42 43 44 45 46 47 48 49 ··· 51 下一页