I just wanted a Double Linked List inherited(derived) from the Simple Linked List using only classes. And i wanted to switch int/float/double whenever i want. Exemple:
1st List: ListD <int>A;
2nd List: ListD <float>B; etc..
Doing operations and such (I'm aware that i must make only int + int (A+B) with this kind of code).
Anyway just one type everywhere. I managed to mae the friend class work. Thank you ^^. i was missing a piece of code at the beggining of the code:
1 2
|
template <class Tip>
class Lista;
|
(thats needed before declaring friend class, or else i get "Lista is not a template".
Now i don't get it. If i insert the code written above on my last post, it doesn't work and says:" first is undeclared.... last is undeclared,..... a function IsEmpty() is necessary..." things like that. If i put
class ListaD : public Lista<int> {
replacing Tip with int it works perfectly. For now i just declared nod<Tip> last, nod<Tip> first, afisare() and isEmpty(). But they should be already be declared, being a inherited class right? Also weird thing is that the only thing inherited is the citire() function. (It works only if i redeclare them)
Sorry for my bad english,i hope you understood.