diff --git a/tyre.h b/tyre.h new file mode 100644 index 0000000..5e7efdf --- /dev/null +++ b/tyre.h @@ -0,0 +1,20 @@ +#ifndef TYRE_H +#define TYRE_H + +#include + +class Tyre // 轮胎类,这里使用了大驼峰命名风格 +{ + std::string brand{}; // 轮胎品牌 +public: + Tyre(const std::string &_brand) : brand{_brand} + { + } + Tyre() = default; // 主动合成的默认构造 + void print() + { + std::cout << "轮胎品牌是" << brand << '\n'; + } +}; + +#endif \ No newline at end of file