I want to create a general abstract TimePeriod
class. Example subclasses of it would be be Day
, Hour
and Minute
.
I also want to create a general TimeData
class that associates a TimePeriod
object with some data, such as two double
s for the lowest and highest temperature during that time period.
Creating an abstract Data
class for this purpose may not be a bad idea. So a TimeData
would associate a TimePeriod
with a Data
.
Here is an example how the hierarchy could look like w.r.t. time:
In addition to the "vertical" parent-child relationship (when I'm working with a certain hour, I want to know which day that hour is in), I also want "horizontal" relationships that allow me to easily loop through the daily data, hourly data, minute data, etc.
Can you give me ideas on how to model this as classes in C++? Do I need to use pointers (in which case I'd prefer smart pointers) or can I use the easier vector
, list
, etc. STL classes?