c++ - When should specific constructors be implemented? -


If my class has different attributes, for example the following code:

  Class status {double latitude; Double longitude; Double height; Pausx Time Time; };  

So we say that this is the class that I want to make, where is the time (currently in the development of the current time) always current time < / Strong>. I do not currently use any other time, it is always the creation time, should I still apply a manufacturer with a time parameter? Maybe it's used later or by any other developer? In short, there are two options:

  1. Writing only 2 constructs:

      position (): latitude (0), longitude (0), alitutde ( 0), Time (PosixCurrentTime ()) {} Status (double latitude, double loan, double alt): Latitude (latitude), longitude, alitutde (alt), time (PosixCurrentTime ()) {}  <3 Write the constructors (both above and below): 

      position (double latitude, double lawn, double alt, poketime t): latitude (latitude), longitude (loan), alitutde ( Alt), time (t) {}  

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -