Skip to content

Conversation

@muyuuuu
Copy link
Contributor

@muyuuuu muyuuuu commented Oct 22, 2024

  1. 这里不加构造函数会编译失败
  2. 才疏学浅,可否解答一下为啥必须加构造函数?
  3. 想催更一下C++内存模型、concept、还有面向数据编程那一块,看的上瘾

额外的,是这章节 md 文件中的 --- 让目录变得这么难看吗?

@muyuuuu
Copy link
Contributor Author

muyuuuu commented Oct 22, 2024

关于第二点,太长时间不写面向对象都快忘了,是不是子类要有自己的构造函数,然后会自动调用父类的构造函数?

@ndroi
Copy link

ndroi commented Oct 22, 2024 via email

Copy link
Contributor

@archibate archibate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

因为C++特色,子类不会自动继承父类的构造函数(除非是没参数的默认构造函数)。
需要using 父类::父类;这样写一下,才能自动继承父类的构造函数。

@muyuuuu
Copy link
Contributor Author

muyuuuu commented Oct 25, 2024

因为C++特色,子类不会自动继承父类的构造函数(除非是没参数的默认构造函数)。 需要using 父类::父类;这样写一下,才能自动继承父类的构造函数。

学习了

@archibate archibate merged commit 254d0ed into parallel101:main Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants