title: C++: Constructors: Parent class parameters and setting values in new instance
body: <p>I'm attempting to create a date and time class using inheritance.</p>
  
  <p>The parent class, Date, has variables month, day, and year.</p>
  
  <p>The Date derived class, DateTime, has the same variables but with hour, minute, and second added. The DateTime instance, when created, must be passed a Date instance and with optional parameters hour, minute, and second. The Date parameter is a requirement. If the optional parameters are not passed, default values of 0 will be applied.</p>
  
  <p>Is there a more efficient way to implement this? I feel like it is tedious to re-set the parameters by retrieving them using a function in the Date instance for the new DateTime instance. </p>
  
  <pre><code>DateTime::DateTime(Date passDate){
    day = passDate.getDay();
    month = passDate.getMonth();
    year = passDate.getYear();
    hour = 0;
    minute = 0;
    second = 0;
  }
  
  DateTime::DateTime(Date passDate, int hourSet){
    day = passDate.getDay();
    month = passDate.getMonth();
    year = passDate.getYear();
    hour = hourSet;
    minute = 0;
    second = 0;
  }
  
  DateTime::DateTime(Date passDate, int hourSet, int minuteSet){
    day = passDate.getDay();
    month = passDate.getMonth();
    year = passDate.getYear();
    hour = hourSet;
    minute = minuteSet;
    second = 0;
  }
  </code></pre>