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
Post a Comment