class_5:在c++中一个类包含另一个类的对象叫做组合

#include 
using namespace std;

class Wheel{
public:
    //成员数据
    string brand; //品牌
    int    year;  //年限
    //真正的成员函数
    void printWheelInfo(); //声明成员函数
};


void Wheel::printWheelInfo()
{
    cout<<"我的轮胎品牌是:"<brand = "米其林二代";
    BMW3.pwl->year  = 2024;

    BMW3.realPrintCarInfo();
    BMW3.wl.printWheelInfo();
    BMW3.pwl->printWheelInfo();
    return 0;
}

class_5:在c++中一个类包含另一个类的对象叫做组合_第1张图片

你可能感兴趣的:(QT,c++,开发语言,算法)