c++ - How to pass a constructor through another constructor -


i have classes date , time. creating class onetime public constructor not sure how can create new date , time inline.

schedule[0]= new onetime("see dentist",    date(2013, 11, 4),    time(11, 30, 0),    time(12, 30, 0));  class onetime {   public:      onetime(  // should put here?  ) } 

this standard approach

class onetime {     std::string description;     date date;     time from_time;     time to_time;      onetime(const std::string& description,             const date& date,             const time& from_time,             const time& to_time)     : description(description),       date(date),       from_time(from_time),       to_time(to_time)     {        ... rest of initialization code, if needed ...     }   ... }; 

Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -