Constructors [Bono]1Constructors•Role of constructors•Constructors for contained objects•Member initializer list•Rationale for initializing•Order of initialization•Code in body of constructor•Constructing objects contained in a vectorProduct and Time examples are from Big C++, by Cay Horsmann and Timothy Budd; Wiley 2005
has intentionally blurred sections.
Sign up to view the full version.
Constructors [Bono]2Role of constructors•Make sure all fields are initialized.•Put the object into a valid state.•Is called automatically when you declare a variable of that type. E.g.Time t;Time t(0, 32, 24);