Answered step by step
Verified Expert Solution
Question
1 Approved Answer
#include #include class Vehicle { protected: std::string brand; int capacity; public: Vehicle ( const std::string& brand, int capacity ) : brand ( brand ) ,
#include #include class Vehicle protected: std::string brand; int capacity; public: Vehicleconst std::string& brand, int capacity : brandbrand capacitycapacity virtual void move; ; class Car : public Vehicle private: std::string model; int year; public: Carconst std::string& brand, const std::string& model, int year : Vehiclebrand modelmodel yearyear void move override std::cout "Driving the car: brand model year std::endl; ; class Train : public Vehicle private: std::string name; public: Trainconst std::string& name, int capacity : VehicleTrain capacity namename void move override std::cout "The train name is running with a capacity of capacity passengers." std::endl; ; int main Car myCarToyota "Camry", ; Train myTrainExpress; myCar.move; myTrain.move; return ; Please represent this code in UML
#include
#include
class Vehicle
protected:
std::string brand;
int capacity;
public:
Vehicleconst std::string& brand, int capacity
: brandbrand capacitycapacity
virtual void move;
;
class Car : public Vehicle
private:
std::string model;
int year;
public:
Carconst std::string& brand, const std::string& model, int year
: Vehiclebrand modelmodel yearyear
void move override
std::cout "Driving the car: brand model year std::endl;
;
class Train : public Vehicle
private:
std::string name;
public:
Trainconst std::string& name, int capacity
: VehicleTrain capacity namename
void move override
std::cout "The train name is running with a capacity of capacity passengers." std::endl;
;
int main
Car myCarToyota "Camry", ;
Train myTrainExpress;
myCar.move;
myTrain.move;
return ;
Please represent this code in UML
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started