c++类构造函数、拷贝函数 、 赋值函数、析构函数

类的拷贝控制

构造函数、拷贝函数 、 赋值函数、析构函数

  class Sales_data{public:Sales_data() = default;// 默认合成 默认构造函数Sales_data(const Sales_data& ) =  default;// 默认合成 拷贝构造函数Sales_data& operator=(const Sales_data&);//  拷贝赋值运算符~Sales_data() = default;// 默认合成 默认析构函数};

Sales_data& Sales_data::operator=(const Sales_data&) = default;// 拷贝赋值运算符 类外定义

使用 delete 删除函数 避免拷贝

   struct NoCopy(){// struct 默认为 publicNoCopy() = default;//  默认合成 默认构造函数    不能是删除函数NoCopy(const NoCopy&) = delete;// 阻止拷贝NoCopy&  operator=(const NoCopy&);//  阻止赋值~NoCopy() = default;// 默认合成 默认析构函数   不能是删除函数};

private 拷贝控制  用户可定义和删除该对象 但不能拷贝它们   不过该类的成员函数 和其 有元函数和有元类 可以 拷贝

  class privateCopy{// class 默认为 private  普通用户无法访问privateCopy(const privateCopy&);// 私有拷贝构造函数privateCopy& operator=(const privateCopy&);// 私有拷贝赋值运算符public:privateCopy() = default; // 默认合成  默认构造函数~privateCopy() = default;// 默认合成 默认析构函数   不能是删除函数

};

指针 与 拷贝构造函数 和 拷贝赋值运算符

  struct Node{char* name;//名字 字符指针int age;// 年龄Node(char* n = " ", int a = 0 ){//默认构造函数name = strdup(n);// strdup()字符串拷贝库函数age = a;}// 拷贝构造函数未定义     编译器自动生成一个(自动生成的 只是逐个对成员复制,遇到指针就会出问题)// 拷贝赋值运算符也未定义 编译器自动生成一个(自动生成的 只是逐个对成员复制,遇到指针就会出问题) };// 执行拷贝时 指针对象会指向同一个对象Node node1("Role", 20), node2(node1);//使用node1 初始化 node2 strcpy(node2.name, "Wendy");// 指向了同一个对象node2.age = 30;// 非指针正常赋值cout << node1.name << " " << node1.age << " " << node2.name << " " << node2.age << endl;// Wendy  20  Wendy  30  // 

定义 拷贝构造函数

  struct Node{char* name;//名字 字符指针int age;// 年龄Node(char* n = " ", int a = 0 ){//默认构造函数name = strdup(n);// strdup()字符串拷贝库函数age = a;}// 拷贝构造函数Node(const Node& n){name = strdup(n.name);age = n.age;}// 拷贝赋值运算符也未定义 编译器自动生成一个  (自动生成的 只是逐个对成员复制,遇到指针就会出问题)};Node node1("Role", 20), node2(node1);//使用node1 初始化 node2  使用拷贝构造函数strcpy(node2.name, "Wendy");node2.age = 30;// 正常赋值cout << node1.name << " " << node1.age << " " << node2.name << " " << node2.age << endl;

// Role 20 Wendy 30  //

定义拷贝赋值运算符  重载 赋值运算符

  struct Node{char* name;//名字 字符指针int age;// 年龄Node(char* n = " ", int a = 0 ){//默认构造函数name = strdup(n);// strdup()字符串拷贝库函数age = a;}// 拷贝构造函数Node(const Node& n){name = strdup(n.name);age = n.age;}// 拷贝赋值运算符Node& operate=(const Node& n){if(this != &n){// 确保赋值运算符的两边不是同一个类的同一个对象,避免重复 定义自己if(name != 0) free(name);//先释放之前的内存(如果之前已经指向了内存,避免内存泄漏)name = strdup(n.name);// 再用 等号 左边的对象初始化 对象age = n.age;}return  *this;// this 起始就是 类对象的地址}};

指针与析构函数  默认的析构函数 只会释放 指针所占据的内存 而不会释放指针指向的内存空间  会造成 内存泄漏

struct Node{
char* name;//名字 字符指针
int age;// 年龄
Node(char* n = " ", int a = 0 ){//默认构造函数
name = strdup(n);// strdup()字符串拷贝库函数
age = a;
}

   // 拷贝构造函数Node(const Node& n){name = strdup(n.name);age = n.age;}// 拷贝赋值运算符Node& operate=(const Node& n){if(this != &n){// 确保赋值运算符的两边不是同一个类的同一个对象,避免重复 定义自己if(name != 0) free(name);//先释放之前的内存(如果之前已经指向了内存,避免内存泄漏)name = strdup(n.name);// 再用 等号 左边的对象初始化 对象age = n.age;}return  *this;// this 起始就是 类对象的地址}

// 定义析构函数
      ~Node(){
      if(name != 0) free(name);//指针不为空,就已经使用了指向的内存,需要free手动释放掉
      }
     
};

通过函数返回引用类型  可以改变类内变量的访问方式   破坏了 隐藏域

  class refTest{public:int& getRefN(){return n;//n为类内私有变量 返回该私有变量引用后 类外就可以访问它}int getN(){return n;//n为类内私有变量}private:int n;} c;//c.n = 6;// 错误  外部直接访问不了 类内私有变量int& k = c.getRefN();//通过返回引用 可以间接访问修改  类内私有变量k = 7;//  类内私有变量 n 被修改为 7cout << c.getN();// 可以看到 n 被修改为 7c.getRefN() = 10;//直接通过 c.getRefN() 来给 类内私有变量 n 赋值

重载

重载输出运算符 <<  为特定类对象 重载输出运算符 返回的是 ostream& 输出流对象的引用

// 一般定义成 非成员函数 在{};外面ostream& operator<<(ostream& os, const Sales_data& item ){os << item.isbn() << " " << item.units_sold << " " << item.revenue << " " << item.avg_price();// 使用了 字符串的、int、double的 输出运算符 类构成类的 输出运算符return os;

}

重载 输入 运算符 >>  返回的是 istream& 输入流对象的引用

  istream& operator>>(istream& is, const Sales_data& item ){double price;// 单价is >> item.bookNo >> item.units_sold >> price;if(is)//检测输入是否成功item.revenue = item.units_sold * priceelseitem = Sales_data();//输入失败,对象呗赋予默认的状态return is;

}

重载 关系运算符  ==  不等于也类似 !=

// 关系运算符  返回类型为 bool  输入两个类对象的 常量 引用 避免拷贝 节省时间 常量限制 避免修改
   bool
operator==(const Sales_item &lhs, const Sales_item &rhs)
{
       // 在类中被是定义为 friend 有元函数
// friend bool operator==(const Sales_item&, const Sales_item&);// 重定向 等于符号 ==
       return lhs.units_sold == rhs.units_sold &&
lhs.revenue == rhs.revenue &&
lhs.isbn() == rhs.isbn();
}

整体 浏览

    #ifndef SALESITEM_H// we're here only if SALESITEM_H has not yet been defined #define SALESITEM_H// Definition of Sales_item class and related functions goes here#include <iostream>#include <string>class Sales_item {// these declarations are explained section 7.2.1, p. 270 // and in chapter 14, pages 557, 558, 561// 操作符 定义friend std::istream& operator>>(std::istream&, Sales_item&);// 重定向输入 >> 符号friend std::ostream& operator<<(std::ostream&, const Sales_item&);// 重定向输出 << 符号friend bool operator<(const Sales_item&, const Sales_item&);// 重定向 小于符号 < friend bool operator==(const Sales_item&, const Sales_item&);// 重定向 等于符号 ==  public:// constructors are explained in section 7.1.4, pages 262 - 265// default constructor needed to initialize members of built-in typeSales_item() = default;Sales_item(const std::string &book): bookNo(book) { }Sales_item(std::istream &is) { is >> *this; }public:// operations on Sales_item objects// member binary operator: left-hand operand bound to implicit this pointerSales_item& operator+=(const Sales_item&);// operations on Sales_item objectsstd::string isbn() const { return bookNo; }double avg_price() const;// private members as beforeprivate:std::string bookNo;      // implicitly initialized to the empty stringunsigned units_sold = 0; // explicitly initializeddouble revenue = 0.0;};// used in chapter 10inlinebool compareIsbn(const Sales_item &lhs, const Sales_item &rhs) { return lhs.isbn() == rhs.isbn(); }// nonmember binary operator: must declare a parameter for each operandSales_item operator+(const Sales_item&, const Sales_item&);inline bool operator==(const Sales_item &lhs, const Sales_item &rhs){// must be made a friend of Sales_itemreturn lhs.units_sold == rhs.units_sold &&lhs.revenue == rhs.revenue &&lhs.isbn() == rhs.isbn();}inline bool operator!=(const Sales_item &lhs, const Sales_item &rhs){return !(lhs == rhs); // != defined in terms of operator==}// assumes that both objects refer to the same ISBNSales_item& Sales_item::operator+=(const Sales_item& rhs) {units_sold += rhs.units_sold; revenue += rhs.revenue; return *this;}// assumes that both objects refer to the same ISBNSales_item operator+(const Sales_item& lhs, const Sales_item& rhs) {Sales_item ret(lhs);  // copy (|lhs|) into a local object that we'll returnret += rhs;           // add in the contents of (|rhs|) return ret;           // return (|ret|) by value}std::istream& operator>>(std::istream& in, Sales_item& s){double price;in >> s.bookNo >> s.units_sold >> price;// check that the inputs succeededif (in)s.revenue = s.units_sold * price;else s = Sales_item();  // input failed: reset object to default statereturn in;}std::ostream& operator<<(std::ostream& out, const Sales_item& s){out << s.isbn() << " " << s.units_sold << " "<< s.revenue << " " << s.avg_price();return out;}double Sales_item::avg_price() const{if (units_sold) return revenue/units_sold; else return 0;}

#endif

模板类

  template<class genType>//声明模板类型class genClass{genType storage[50];//模板类型 数组};// 定义genClass<int>    intObject;   // int 类型数组genClass<double> doubleObject;// double 类型数组// 其二也可以将 数组大小推迟定义template<class genType, int size = 50>// 声明模板类型 书序大小默认为50class genClass{genType storage[size];//模板类型 数组};// 定义genClass<int>    intObject1;         // int 类型数组 默认   大小genClass<int, 100>    intObject2;    // int 类型数组 数组大小为 100 genClass<double, 123> doubleObject;  // double 类型数组  数组大小为 123

模板函数

  // 交换两个变量的值template<class genType>//声明模板类型void my_swap(genType& num1, genType& num2){   // 注意为 引用 需要对实参修改genType temp = num1;num1 = num2;num2 = temp;}

类的 继承

  #include <iostream> using namespace std;// 基类 class BaseClass {public://共有类型 哪里都可以访问 BaseClass() { }//默认构造函数 void f(char *s = "unknown") {cout << "Function f() in BaseClass called from " << s << endl;h();//类内可以访问 类的私有函数 }protected:// 保护类型  子类 和 友元函数/有元类 可以访问 void g(char *s = "unknown") {cout << "Function g() in BaseClass called from " << s << endl;}private:// 类内 和 元函数/有元类 可以访问 void h() {cout << "Function h() in BaseClass\n";}};// 子类 Derived1Level1 共有继承自 基类   BaseClass class Derived1Level1 : public virtual BaseClass {public:void f(char *s = "unknown") {cout << "Function f() in Derived1Level1 called from " << s << endl;g("Derived1Level1");// 本子类没有重写g() 因此调用的是 父类的g() 保护类型可以继承 子类内可以访问 // 函数时调用的基类的 但是参数 还是按子类传入的  h("Derived1Level1");// 本子类重写了h()(本身父类的为私有,子类也调用不了), 因此调用的是 自己的 h() }void h(char *s = "unknown") {cout << "Function h() in Derived1Level1 called from " << s << endl;}};class Derived2Level1 : public virtual BaseClass {public:void f(char *s = "unknown") {cout << "Function f() in Derived2Level1 called from " << s << endl;g("Derived2Level1");// 调用基类的g() 保护类型的函数  但是参数按 子类传入的参数  // h(); // 错误 : h()为基类的 私有函数 ,子类访问不了 BaseClass::h() is not accessible}};//二级继承 class DerivedLevel2 : public Derived1Level1, public Derived2Level1 {public:void f(char *s = "unknown") {cout << "Function f() in DerivedLevel2 called from " << s << endl;g("DerivedLevel2");// g()函数只有基类有 实现 调用的是基类的 保护继承g() 但是参数是 子类 最新传递的 Derived1Level1::h("DerivedLevel2");// 父亲Derived1Level1有h()  爷爷 也有h() 需要指定调用的哪一个  参数都是最新的 BaseClass::f("DerivedLevel2");// f()函数  两个父亲 和 一个爷爷都有实现,需要指明调用哪一个  参数都是最新的 }};int main() {BaseClass bc;//基类 Derived1Level1 d1l1;//子类1 Derived2Level1 d2l1;//子类2 DerivedLevel2 dl2;//子类的子类 bc.f("main(1)");// // bc.g(); // 错误: 保护类型 类外访问不了 BaseClass::g() is not accessible// bc.h(); // 错误: 私有类型 类外访问不了 BaseClass::h() is not accessiblecout << "---------------"<< endl; d1l1.f("main(2)");//首先调用子类重写的 f() // 内部调用了 基类的g()(函数时调用的基类的 但是参数 还是按子类传入的 ) 和 自身重写的 h() // d1l1.g(); // 错误: 在子类内 可以访问父类的保护类型函数g(), 外面访问不了 BaseClass::g() is not accessibled1l1.h("main(3)");// 调用子类自己重写的函数 参数按最新传入的 d2l1.f("main(4)");// 调用子类的函数f(),内部调用了父类的b保护类型函数g() 但是参数按子类传入的参数 // d2l1.g(); // 父类的保护函数g() 在子类内可以访问 ,外部访问不了 错误 BaseClass::g() is not accessible// d2l1.h(); // 父类的私有函数 子类内,外部都访问不了 错误: BaseClass::h() is not accessibledl2.f("main(5)");//类自身f() 内部 爷爷的 g() 父亲1的 h() 爷爷的  f()  参数都是最新传入的 // dl2.g(); // error: BaseClass::g() is not accessibledl2.h();//外部能访问 父亲  Derived1Level1的 共有类型函数 h() return 0;}/*Function f() in BaseClass called from main(1)Function h() in BaseClassFunction f() in Derived1Level1 called from main(2)Function g() in BaseClass called from Derived1Level1Function h() in Derived1Level1 called from Derived1Level1Function h() in Derived1Level1 called from main(3)Function f() in Derived2Level1 called from main(4)Function g() in BaseClass called from Derived2Level1Function f() in DerivedLevel2 called from main(5)Function g() in BaseClass called from DerivedLevel2Function h() in Derived1Level1 called from DerivedLevel2Function f() in BaseClass called from DerivedLevel2Function h() in BaseClassFunction h() in Derived1Level1 called from unknown--------------------------------Process exited with return value 0Press any key to continue . . .*/ 

类的多态性  基类定义的虚函数,子类(其他类)可以重写,根据指针当前指向的对象类型动态调用属于哪一确定类的该虚函数

  多态性指的是获得多种形态的能力。在 OOP 中,多态性指的是用同样的函数名称表示多个函数,而这些函数是不同对象的成员。对于所谓的静态绑定来说,调用哪个函数是在编译阶段确定的。而对于动态绑定,则要推迟到运行阶段才能确定。在 C++中,动态绑定是通过将成员函数声明为 virtual 来实现的。在这种方式中,如果对虚函数成员进行调用,那么选择执行哪个函数并不依赖于声明的指针类型,而是依赖于指针当前指向的类型。#include <iostream>using namespace std;//类1 class Class1 {public:virtual void f() {//虚函数   支持动态绑定 运行时确定 cout << "Function f() in Class1\n";}void g() {// 静态绑定 在编译阶段确定 cout << "Function g() in Class1\n";}};// 类2 class Class2 {public:virtual void f() {//虚函数   支持动态绑定 运行时确定 cout << "Function f() in Class2\n";}void g() {cout << "Function g() in Class2\n";}};//类3 class Class3 {public:virtual void h() {//虚函数   支持动态绑定 运行时确定 cout << "Function h() in Class3\n";}};int main() {Class1 object1, *p;// 类1 对象 object1  指针 p 声明为 Class1*类型Class2 object2;// 类2 对象 object2Class3 object3;// 类3 对象 object3p = &object1;//当前p 指向  Class1类的  object1对象  p->f();// 动态绑定 到 Class1类的 f()虚函数     Function f() in Class1p->g();// 静态绑定 在编译阶段确定              Function g() in Class1p = (Class1*) &object2;// 当前p 指向  Class2类的  object2对象 p->f();// 动态绑定 到 Class2类的 f()虚函数     Function f() in Class2p->g();// 静态绑定 在编译阶段确定              Function g() in Class1p = (Class1*) &object3;// 当前p 指向  Class3类的  object3对象 p->f(); // 程序会结束 报错  Class3类 无虚函数  f()   devc测试 竟然输出了  Function h() in Class3p->g(); // 静态绑定 在编译阶段确定             Function g() in Class1//p->h(); // h() is not a member of Class1;return 0;}/* 该程序的输出如下所示:Function f() in Class1Function g() in Class1Function f() in Class2Function g() in Class1// 程序会结束    Class3类 无虚函数  f()   devc测试 竟然输出了  Function h() in Class3Function g() in Class1*/

多态性  优点

  多态性是 OOP 的一项强大功能。可以利用这个特性将一个标准消息发送给许多不同的对象,而不需要指定如何处理消息,也不需要知道对象是什么类型。接收者负责解释和处理消息。发送者不需要根据接收者的类型来修改消息,也不需要使用 switch 或 if-else 语句。此外还可以在复杂的程序中加入新的单元而不需要重新编译整个程序。

有元函数 有元类 拓展了C++隐藏特性

  class C {int n;//class 默认 属性为 provide 私有friend class B;//有元类friend int f();//有元函数} obc;int f(){return 10 * obc.n; // 函数f() 可以访问 类C的对象 obc 的所有类型的变量和方法}class B {// 函数B 可以访问 类C的对象 obc 的所有类型的变量和方法int m;int function(){return  obc.n;}}

函数运算符的重载 类   函数运算符 () operator()

  class classfuc{public:classfuc() {// 默认构造函数}double operator() (double x){// 重载函数运算符 ()return 2*x;}double dou(double x){//定义功能函数return 2*x}};//定义使用 重载了函数运算符的类 定义的函数double sum2(classfuc f, int n, int m){double res = 0.0;for (int i = n; i < = m; ++i){res += f(i); // res += f.dou(i);//使用 功能函数}return res;}// 使用函数classfuc fc;cout << sum2(cf, 2, 10) << endl;

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.xdnf.cn/news/146926.html

如若内容造成侵权/违法违规/事实不符,请联系一条长河网进行投诉反馈,一经查实,立即删除!

相关文章

【算法】动态规划

文章目录 概述背包问题01背包问题&#xff1a;代码示例部分背包代码示例 完全背包代码示例 多重背包代码示例 总结提升 概述 动态规划&#xff08;Dynamic Programming&#xff09;是一种通过将问题划分为相互重叠的子问题来解决问题的算法思想。其核心思想是通过保存已经计算…

网络工程师怎么才算学好

学网络工程师怎么样才算学好&#xff1f;这个朋友他说他现在准备跟我学这个网络工程师。他说他理解的网络工程师就是要不断的在技术上进行积累&#xff0c;至于产品还有客户&#xff0c;他不知道该怎么样以后去学习。我先说一下这个网络工程师你在课程或者技术上学习&#xff0…

Academic accumulation|社会创业研究:过去的成就和未来的承诺

文献来源&#xff1a;Saebi T, Foss N J, Linder S. Social entrepreneurship research: Past achievements and future promises[J]. Journal of management, 2019, 45(1): 70-95. 一、文章介绍 &#xff08;一&#xff09;文章主要包含什么&#xff1f; SE越来越受到学术界的…

中睿天下荣获2023全国智能驾驶测试赛车联网安全比赛第一名

9月24日&#xff0c;由工业和信息化部、公安部、交通运输部、中国科学技术协会、北京市人民政府共同主办的2023世界智能网联汽车大会展览会在北京闭幕。同期举行的全国智能驾驶测试赛&#xff08;京津冀赛区&#xff09;宣布比赛结果&#xff0c;中睿天下凭借过硬的产品实力&am…

了解”变分下界“

“变分下界”&#xff1a;在变分推断中&#xff0c;我们试图找到一个近似概率分布q(x)来逼近真实的概率分布p(x)。变分下界是一种用于评估近似概率分布质量的指标&#xff0c;通常用来求解最优的近似分布。它的计算涉及到对概率分布的积分或期望的估计

[中间件~大厂面试题] 腾讯三面,40亿的QQ号如何去重

前言&#xff1a; 在Spring Boot框架下&#xff0c;可以使用以下方法来去重40亿个QQ号.请注意&#xff1a;QQ号码的理论最大值为 2 32 − 1 2^{32} - 1 232−1&#xff0c;大概是43亿左右。 文章目录 提前总结(总分总&#xff5e;&#xff5e;&#xff5e;)最粗鲁的方式1. 使用…

1、手把手教你学会使用 FlinkSQL客户端

目录 1、FlinkSQL客户端的功能 2、FlinkSQL客户端启动参数配置 2.1 基本语法 2.2 相关参数([MODE])&#xff1a; 2.3 相关参数(embedded [OPTIONS])&#xff1a; 3、启动Flink的sql-client 3.1 启动时使用初始化脚本 3.2 启动时指定依赖的jar包 3.3 基于yarn-session模…

解决java.io.FileNotFoundException: HADOOP_HOME and hadoop.home.dir are unset.的错误

文章目录 1. 复现错误2. 分析错误3. 解决问题3.1 下载Hadoop3.2 配置Hadoop3.3 下载winutils3.4 配置winutils 1. 复现错误 今天在运行同事给我的项目&#xff0c;但在项目启动时&#xff0c;报出如下错误&#xff1a; java.io.FileNotFoundException: java.io.FileNotFoundEx…

密码技术 (5) - 数字签名

一. 前言 前面在介绍消息认证码时&#xff0c;我们知道消息认证码虽然可以确认消息的完整性&#xff0c;但是无法防止否认问题。而数字签名可以解决否认的问题&#xff0c;接下来介绍数字签名的原理。 二. 数字签名的原理 数字签名和公钥密码一样&#xff0c;也有公钥和私钥&am…

【分布式事务】

文章目录 解决分布式事务的思路seata四种模式1. XA模式2. AT模式AT模式与XA模式的区别是什么&#xff1f;脏写问题 3. TCC模式事务悬挂和空回滚 4. SAGA模式 四种模式对比口述AT模式与TCC模式高可用 什么是分布式事务&#xff1f; 分布式事务&#xff0c;就是指不是在单个服务或…

JAVA 异常分类及处理

1 概念 如果某个方法不能按照正常的途径完成任务&#xff0c;就可以通过另一种路径退出方法。在这种情况下会抛出一个封装了错误信息的对象。此时&#xff0c;这个方法会立刻退出同时不返回任何值。另外&#xff0c;调用 这个方法的其他代码也无法继续执行&#xff0c;异常处理…

vSAN7.0更换硬盘步骤

更换容量盘 预先检查 查看故障硬盘 清单->集群->监控->vsan->skyline运行->物理磁盘->运维运行状况 检查数据同步状态 清单->集群->监控->vsan->重新同步对象&#xff0c;数值全为0表示未重建。 数据迁移检查 清单->集群->监控->…

ili9431液晶 tft_espi图形库演示 时钟、天气、滚动、气象图标

米思齐tft_spi模块库演示程序。心知天气、阿里云时钟、WiFi信号强度检测、1分钟滚屏、更新天气时间为15分钟、加入天气图标。更新天气次数。断网检测 。此程序为tft_eSPI图形库演示、如感觉好可以自行优化。 ili9431tft_espi库是用于ESP32和ESP8266芯片的TFT LCD驱动程序库&am…

基于Java的厨艺交流平台设计与实现(源码+lw+部署文档+讲解等)

文章目录 前言具体实现截图论文参考详细视频演示为什么选择我自己的网站自己的小程序&#xff08;小蔡coding&#xff09;有保障的售后福利 代码参考源码获取 前言 &#x1f497;博主介绍&#xff1a;✌全网粉丝10W,CSDN特邀作者、博客专家、CSDN新星计划导师、全栈领域优质创作…

初级篇—第一章初识数据库

文章目录 为什么要使用数据库数据库与数据库管理系统数据库的相关概念数据库与数据库管理系统的关系 常用的数据库为什么如此多的厂商要选用MySQL&#xff1f;MySQL的目录 RDBMS 与 非RDBMS关系型数据库(RDBMS)非关系型数据库(非RDBMS) 关系型数据库设计规则表、记录、字段表的…

mathtype如何嵌入到word中?详细mathtype安装步骤教程

mathtype是一款功能特别强大的数学方式编辑软件&#xff0c;为用户提供各种强大的数学公式符号帮助用户进行计算&#xff0c;并且速度很快。有小伙伴知道mathtype如何嵌入到word中吗&#xff0c;这里小编就给大家详细介绍一下mathtype嵌入到word中的方法&#xff0c;有需要的小…

【JVM】第五篇 垃圾收集器G1和ZGC详解

导航 一. G1垃圾收集算法详解1. 大对象Humongous说明2. G1收集器执行一次GC运行的过程步骤3. G1垃圾收集分类4. G1垃圾收集器参数设置5. G1垃圾收集器的优化建议6. 适合使用G1垃圾收集器的场景?二. ZGC垃圾收集器详解1. NUMA与UMA2. 颜色指针3. ZGC的运作过程4. ZGC垃圾收集器…

【源码】hamcrest 源码阅读及空对象模式、模板方法模式的应用

文章目录 前言1. 类图概览2. 源码阅读2.1 抽象类 BaseMatcher2.1 接口 Description提炼模式&#xff1a;空对象模式 2. 接口 Description 与 SelfDescribing 配合使用提炼模式 模板方法 后记 前言 hamcrest &#xff0c;一个被多个测试框架依赖的包。听说 hamcrest 的源码质量…

flutter开发实战-webview插件flutter_inappwebview使用

flutter开发实战-webview插件flutter_inappwebview使用 在开发过程中&#xff0c;经常遇到需要使用WebView&#xff0c;Webview需要调用原生的插件来实现。常见的flutter的webview插件是webview_flutter&#xff0c;flutter_inappwebview。之前整理了一下webview_flutter&…

OpenCV之直线曲线拟合

直线拟合fitLine void fitLine( InputArray points, OutputArray line, int distType,double param, double reps, double aeps ); points:二维点的数组或vector line:输出直线,Vec4f (2d)或Vec6f (3d)的vector distType:距离类型 param:距离参数 reps:径向的精度参数 a…