Home template, inheritance and polymorphism c++
Reply: 0

template, inheritance and polymorphism c++

user819 Published in April 25, 2018, 6:08 pm

I 'm trying to make a sorting classes like (merge, quick, shell ...etc), and connect them with a bigger parent class call it Sorter and I m using templates. However when I m trying to connect any of the children classes. And here is a sample of one of the child classes.

class MergeSort : public Sorter <class T>
{ //code of the mergesort here }

I get these errors

expected template-name before '<' token

expected '{' before '<' token

expected UNQUALIFIED-ID before '<' token

EDIT This is the code for the Sorter class

template <class T>
class Sorter {
virtual void sort(vector<T>&, int, int) = 0;
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.309133 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO