- 博客(31)
- 收藏
- 关注
原创 0110_实用的工具
1_适用于 Linux 的 Windows 子系统文档https://docs.microsoft.com/zh-cn/windows/wsl/666
2020-07-16 11:01:49
210
原创 c++多态(vs2019实现)
#define _CRT_SECURE_NO_WARNINGS#include <iostream>#include <string>using namespace std;//知识点1//动态联编和静态联编class Animal {public: // 在父类上声明一个虚函数 virtual void speak() { cout << "动物在说话" << endl; }};class Cat :public Anima.
2020-06-21 16:25:11
344
原创 c++ 函数调用运算符重载
1 #include <iostream> // 标准的输入输出 2 using namespace std; 3 4 class Person { 5 public: 6 void operator()(string text) 7 { 8 ¦ cout << text << endl; 9 } 10 }; 11 12 void test01() 13 { 14 Person ..
2020-06-11 18:29:34
228
原创 c++ 关系运算符重载
1 #include <cstring> 2 #include <iostream> // 标准的输入输出 3 using namespace std; 4 5 class Person { 6 public: 7 Person(string name, int a) 8 { 9 ¦ this->m_name = name; 10 ¦ this->m_a = a; 11 } 12 ..
2020-06-11 18:19:08
183
原创 c++ 赋值运算符的重载
1 #include <cstring> 2 #include <iostream> // 标准的输入输出 3 using namespace std; 4 5 class Person { 6 public: 7 // 系统默认提供构造函数、拷贝构造、析构函数、赋值运算符 8 Person(int a) 9 { 10 ¦ this->m_A = a; 11 } 12 int m_A..
2020-06-10 10:15:23
209
原创 c++ 智能指针的实现
1 #include <iostream> // 标准的输入输出 2 using namespace std; 3 4 class Person { 5 public: 6 Person(int a) 7 { 8 ¦ m_A = a; 9 }; 10 void showage() 11 { 12 ¦ cout << "showage函数调用" << endl; 13.
2020-06-10 09:04:11
212
原创 c++ ++运算符重载
1 #include <iostream> // 标准的输入输出 2 using namespace std; 3 4 class MyInteger { 5 public: 6 MyInteger() 7 { 8 ¦ m_A = 0; 9 } 10 int m_A; 11 }; 12 13 // 前置++重载 14 MyInteger& operator++(MyInteger&..
2020-06-10 08:26:47
211
原创 c++ 左移运算符重载
1 #include <iostream> // 标准的输入输出 2 using namespace std; 3 4 class Person { 5 public: 6 Person() {} 7 8 Person(int a, int b) 9 { 10 ¦ this->m_A = a; 11 ¦ this->m_B = b; 12 } 13 14 int m_A..
2020-06-08 20:09:40
528
原创 C++ 加号运算符重载
1 #include <iostream> // 标准的输入输出 2 using namespace std; 3 4 class Person { 5 public: 6 Person() {} 7 Person(int a, int b) 8 ¦ : m_A(a) 9 ¦ , m_B(b) 10 { 11 } 12 13 // 利用成员函数重载加法运算符 14 /* Pe..
2020-06-08 20:05:46
800
原创 C++ 成员函数做友元函数
1 #include <iostream> // 标准的输入输出 2 using namespace std; 3 4 class Building; 5 class goodFriend { 6 public: 7 goodFriend(); 8 void visit(); 9 void visit2(); 10 Building* b; 11 }; 12 class Building { 13 friend..
2020-06-06 16:44:17
275
原创 c++ 全局函数做友元函数
1 #include <iostream> // 标准的输入输出 2 using namespace std; 3 4 class Building { 5 6 // 让全局函数成为友元函数 加上friend关键字 7 friend void Visit(Building* b); 8 9 public: 10 Building() 11 { 12 ¦ this->bedRoom = "卧室"; 1.
2020-06-03 08:07:09
180
原创 c++ 类做友元类
1 #include <iostream> // 标准的输入输出 2 using namespace std; 3 4 class Building { 5 friend class goodFriend; 6 7 public: 8 Building(); // 类内申明,类外实现 9 public: 10 string m_sittingrookm; 11 12 private: 13 string m_bedr.
2020-06-03 08:05:03
567
原创 c++ 常函数和常对象
1 #include <iostream> // 标准的输入输出 2 using namespace std; 3 4 class Person { 5 public: 6 Person() 7 { 8 ¦ //构造中修改属性 9 ¦ //this永远指向本体 10 11 ¦ this->m_A = 0; 12 ¦ this->m_B = 0; 13 } 14 ..
2020-05-28 17:44:20
191
原创 c++ this指针学习笔记
1 #include <iostream> // 标准的输入输出 2 using namespace std; 3 4 class Person { 5 public: 6 Person(int age) 7 { 8 ¦ // 用于解决命名冲突 9 ¦ this->age = age; 10 } 11 12 // 对比年龄 13 void compareAge(Person&am..
2020-05-28 16:48:35
109
原创 c++ 空指针访问成员函数注意事项
1 #include <iostream> // 标准的输入输出 2 using namespace std; 3 4 class Person { 5 public: 6 void show() 7 { 8 ¦ cout << "Person show" << endl; 9 } 10 11 void showAge() 12 ...
2020-05-28 16:46:49
123
原创 C++ 成员函数和成员变量分开存储
1 #include <iostream> // 标准的输入输出 2 using namespace std; 3 4 class Person { 5 public: 6 int m_A; //非静态成员变量,属于对象身上 4 7 void func() {}; //非静态成员函数,不属于对象身上 8 static int m_B; //静态成员函数,不属于对象身上 9
2020-05-28 10:19:28
196
原创 C++单例模式2代码
1 #include <iostream> // 标准的输入输出 2 using namespace std; 3 4 class Printer { 5 private: 6 Printer() 7 { 8 ¦ m_Count = 0; 9 } 10 >> 11 Printer(const Printer& P) 12 { 13 ...
2020-05-28 09:41:34
160
原创 c++ 单例模型案例
1 #include <iostream> // 标准的输入输出 2 using namespace std; 3 4 // 单例模式案例 5 class Chairman { 6 private: 7 Chairman() 8 { 9 ¦ cout << "创建国家主席" << endl; 10 } 11 12 Chairman(co...
2020-05-27 21:44:32
105
原创 c++ 静态成员和静态成员函数
1 #include <iostream> // 标准的输入输出 2 using namespace std; 3 4 class Person { 5 public: 6 Person() 7 { 8 } 9 static int m_Age; //加入static就是静态成员变量,会共享数据 10 // 静态成员变量,在类内声明,在类外初始化 11 }; 12 int Person::m_Age = 0; /..
2020-05-27 15:03:46
195
原创 c++ new和delete运算符
1 #include <iostream> // 标准的输入输出 2 using namespace std; 3 4 class Person { 5 public: 6 Person() 7 { 8 ¦ cout << "调用默认构造函数" << endl; 9 } 10 11 ~Person() 12 { 13 ¦ cout << "调用默认析..
2020-05-26 21:32:23
110
原创 C++ 类对象作为成员
1 #include <iostream> // 标准的输入输出 2 using namespace std; 3 4 class Game { 5 public: 6 Game() 7 { 8 ¦ cout << "Game的构造函数调用" << endl; 9 } 10 11 Game(string game) 12 { 13 ¦ cout <<..
2020-05-26 18:32:25
708
原创 c++ 初始化列表学习代码
1 #include <iostream> // 标准的输入输出 2 using namespace std; 3 4 class Person { 5 public: 6 /* 7 Person() 8 { 9 } 10 11 // 有参构造初始化 12 Person(int a, int b, int c) 13 { 14 ¦ m_A = a; 15 ¦ m_B.
2020-05-21 21:58:34
247
原创 c++ 深拷浅拷贝学习代码
1 #include <cstring> 2 #include <iostream> // 标准的输入输出 3 using namespace std; 4 5 class Person { 6 public: 7 Person() 8 { 9 } 10 Person(char const* name, int age) 11 { 12 ¦ m_Name = (char*)malloc(s..
2020-05-21 14:30:05
168
原创 C++ 拷贝构造函数的调用时机代码
1 #include <iostream> // 标准的输入输出 2 using namespace std; 3 4 5 class Person 6 { 7 public: 8 Person() 9 { 10 ¦ cout << "无参构造函数" << endl; 11 } 12 >> 13 Pe...
2020-05-20 15:02:57
112
原创 C++ 构造函数的调用和分类代码
1 #include <iostream> // 标准的输入输出 2 using namespace std; 3 4 //分类 5 //按照参数分类 无参构造函数(默认构造函数) 有参构造函数 6 //按照类型分类 普通构造函数 拷贝构造函数 7 8 class Person{ 9 public: 10 // 无参构造函数 11 Person() 12...
2020-05-20 14:11:54
236
原创 C++构造函数/析构函数代码
构造函数和析构函数学习代码 1 #include <iostream> // 标准的输入输出 2 using namespace std; 3 4 class Person{ 5 public: // 析构函数和构造函数的权限必须是public 6 Person(){ 7 ¦ cout << "构造函数" << endl; 8 } 9 10 ~Person(){ 11 ¦
2020-05-13 06:52:18
481
原创 大话数据结构---线性表的链式存储结构增删改查代码
#include "stdio.h" #include "string.h"#include "ctype.h" #include "stdlib.h" #include "io.h" // Linux环境为#include "sys/io.h" #include "math.h" #include "time.h"#define OK 1#define ERROR 0#define TRUE 1#define FALSE 0#define MAXS.
2020-05-10 15:24:20
322
原创 大话数据结构--线性表的顺序存储结构代码
#include "stdio.h" #include "stdlib.h" #include "io.h" #include "math.h" #include "time.h"#define OK 1#define ERROR 0#define TRUE 1#define FALSE 0#define MAXSIZE 20 /* 存储空间初始分配量 *...
2020-04-18 09:44:33
310
原创 使用Linux中遇到的技术问题解决方案
使用Linux中遇到的技术问题解决方案1、主机与虚拟机文件共享的相关问题1、在虚拟机中找不到所共享的文件方案一https://blog.youkuaiyun.com/u010687717/article/details/104017236?depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLea...
2020-04-08 13:57:25
234
原创 关于解决ansys17.0 安装后出现ANSYSLI exited or could not read server port ANSYSLI_DEMO_PORT 的决解方案!
关于解决ansys17.0 安装后出现ANSYSLI exited or could not read server port ANSYSLI_DEMO_PORT 的决解方案!1.问题阐述小洪安装ansys后,通过破解软件,快乐的玩耍了Ansys一个多月。然而,一个多月后,不愉快的事情发生了!在一个充满激情的早上,小洪打开了workbench,结果竟然出现了下面的错误。ANSYSLI exi...
2019-11-19 11:12:19
19003
15
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人