Easy_rider
 
Loading...
Searching...
No Matches
Road.h
Go to the documentation of this file.
1
6#ifndef ROAD_H
7#define ROAD_H
8
9#include "Intersection.h"
10
16class Road {
17public:
23 Road();
24
33 Road(const Intersection &from, const Intersection &to, int maxSpeed);
34
39 Intersection getFrom() const;
40
45 Intersection getTo() const;
46
51 double getLength() const;
52
57 int getMaxSpeed() const;
58
59private:
60 Intersection from_;
61 Intersection to_;
62 double length_;
63 int maxSpeed_;
68 void computeLength();
69};
70
71#endif // ROAD_H
Declaration of the Intersection class representing a point in 2D space.
Represents a point (intersection) in a 2D coordinate system.
Definition Intersection.h:16
Represents a road connecting two Intersections in 2D space, with a computed length and a maximum spee...
Definition Road.h:16
Intersection getTo() const
Retrieves the ending Intersection.
Definition Road.cpp:27
int getMaxSpeed() const
Retrieves the maximum speed for this road.
Definition Road.cpp:31
Road()
Default constructor. Initializes both endpoints at (0,0), length to 0.0, and maxSpeed to 0.
Definition Road.cpp:9
Intersection getFrom() const
Retrieves the starting Intersection.
Definition Road.cpp:25
double getLength() const
Retrieves the computed length of the road.
Definition Road.cpp:29