Ask your own question, for FREE!
Computer Science 16 Online
OpenStudy (anonymous):

C plus plus template class counter { public : counter(Type N=0) { data = N; } void increment(Type D=1) { data += D; } }; template class general_counter : public counter { public: /* This line */ general_counter(Type N=0) : counter(N) { } void setcounter(Type N=0) { data = N; } } Can we initialize the variable that is argument to a constructor, does it have any specific purposes? Why do we call the constructor of the base template class in the inherited class?

OpenStudy (anonymous):

Because the constructor of the superclass initializes "data."

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!