I need to print out a bunch of Objects from a dynamic array using the overloaded << operator.
I've overloaded the << operator this way:
ostream& operator<<(ostream& os, Person* dt)
{
return os << dt->getName();//getName returns a char*
}
Now this works just fine with regular pointers, however as soon as I try doing something like this:
Person *p = new Person("Dany", 4);
Object** obj=new Object*[sizeof(p)];
obj[0] = p;
cout << obj << endl;
I get a meaningless value. Keep in mind the Person class is a derivative of the abstract Object class.