# 类的继承与构造函数

* 如果基类有默认构造函数，派生类缺省，那么会自动有一个默认构造函数
* 如果基类没有默认构造函数，即只有带参数的构造函数，派生类缺省，应该会报错
* 如果基类既有默认构造函数，又有带参数的构造函数，派生类缺省，自动默认构造函数
* 想用带参数的构造函数，一定要手动
* C++11新增特性：using BaseClass::BaseClass;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tysun.gitbook.io/c++/lei/lei-de-ji-cheng-yu-gou-zao-han-shu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
