2023年5月27日,周六晚上:
今天下午写麻雀键值数据库时遇到了这个问题,还好解决了
#include <iostream>
class Car{
public:
std::string color;
};
class People{
public:
Car _car;
public:
People(Car car);
};
People::People(Car car){
_car=car;
}
int main(){
Car car1;
car1.color="yellow";
People Tom(car1);
std::cout<<Tom._car.color<<std::endl;
return 0;
}