Binghamton University

Interview Question

Software Engineer Interview Vestal, NY

Given two classes: class B { public: B(args_1); B(args

  _2); // and many constructors with different arg lists }; class D : public B { public: D(args_1) : B(args_1) {} D(args_2) : B(args_2) {} // and many constructors with different signatures similarly implemented // some additional stuff specific to D }; Assume that the arg list for B's constructors are quite long and may be revised pretty often in the future, in which case D's constructors have to be recoded correspondingly. Duplicating the update by copy-and-paste will certainly work here. Can you propose a better way so that the update can be done in one place without copy-and-paste duplication?

Add Answers or Comments

To comment on this, Sign In or Sign Up.