parent
b241b242c2
commit
f5874b183b
@ -0,0 +1,20 @@
|
||||
#ifndef DRIVER_H
|
||||
#define DRIVER_H
|
||||
|
||||
#include <iostream>
|
||||
|
||||
class Driver // 司机类,这里使用了大驼峰命名风格
|
||||
{
|
||||
std::string name{}; // 司机名字
|
||||
public:
|
||||
Driver(const std::string &_name) : name{_name}
|
||||
{
|
||||
}
|
||||
Driver() = default; // 主动合成的默认构造
|
||||
void print()
|
||||
{
|
||||
std::cout << "司机名字是" << name << '\n';
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in new issue