Write a class named as Bus that contains the attributes which are mentioned below:
The name of Bus.
The direction of Bus (North (N), South(S), East(E), West (W))
The position of Bus (from imaginary zero point)
class Bus
{
public:
// data fields
string name;
char direction;
int position;
Bus()
{
this->name = name;
this->direction = direction;
position = 0;
}
};
Comments
Leave a comment