I’m trying to extend this class
template <class T> class dynamic_array
This does not work
class merge_sort : public dynamic_array
What is the proper way to extend the class?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You have to provide an argument for the template. If you want to use a fixed argument, say
int, then you would do:If you instead want to keep the extended class as generic, you would do:
Note that merge sort is an algorithm, and as such it would be better off as a free function than as an object. According to OOP, you should ask is
merge_sortadynamic_array? For me the answer sounds as no, so I would do this instead: