I want to make a priority queue class that I can reuse again and again in different programs, which stores only one type/class in it.
I can keep out any other types/classes from entering the queue by using compareTo methods, but that means the queue class should require the compareTo method in all of types/classes that enter the queue.
I know that in Java, you can make a class implement Comparable to ensure that that class implements a compareTo method. So I was wondering if there was something similar in c++.
As well, I can't use templates, so, any alternatives would be appreciated. The reason that templates are off limits aren't known to me either, the one asking for this program won't shed some light on that. It must be purely my own code for the priority queue as well.
It sounds like you want to build interfaces in C++. You should check out pure virtual base classes. An example can be found here:
How do you declare an interface in C++?
More can be found here.