Articles
127
Tags
0
Categories
17
首页
归档
友链
李瑞琦的博客
05 继承及多态
首页
归档
友链
05 继承及多态
Created
2025-10-31
|
Updated
2025-10-31
|
03-C++
|
Post Views:
Author:
Li Ruiqi
Link:
https://li-ruiqi777.github.io/03-C++/05-继承及多态.html
Copyright Notice:
All articles on this blog are licensed under
CC BY-NC-SA 4.0
unless otherwise stated.
Previous
06 运算符重载
Next
04 构造函数
构造函数分类 C++中有一下几类构造函数 以一下这个类为例: 1234class Person{ int age; std::string name;}; 1.默认构造函数没有参数,用于创建一个具有默认值的Person对象。 1Person()=default; 2.参数化构造函数1Person(int a, std::string n) : age(a), name(n) {} 3.拷贝构造函数使用另一个对象来初始化当前对象。 1Person(const Person& other) : age(other.age), name(other.name)...
Li Ruiqi
总有低谷
Articles
127
Tags
0
Categories
17
Follow Me