It was that! Furthermore always at first sight: I have to do this:
class Fruit {
virtual friend ostream& operator<<(ostream& os, const Fruit& f) { }
};
class Apple : public Fruit {
friend ostream& operator<<(ostream& os, const Apple& a) { }
};
//main.cpp
Fruit* f = new Apple;
cout << *f;
class Fruit {
virtual friend ostream& operator<<(ostream& os, const Fruit& f) { }
};
class Apple : public Fruit {
friend ostream& operator<<(ostream& os, const Apple& a) { }
};
//main.cpp
Fruit* f = new Apple;
cout << *f;
To copy to clipboard, switch view to plain text mode
This above doens't work.......what I like obtain is make virtual the operato<< (I guess you can guess it from the piece of code).....
thanks....
Bookmarks