View Single Post
  #15  
Old 02-26-2004, 04:07 AM
Merth
Dragon
 
Join Date: May 2003
Location: Seattle, WA
Posts: 609
Default

Quote:
If the code above is NOT polymorphism, but is overloading, could you maybe give me a simple example of poly?
Simple OO polymorphism:
Code:
class foo
{
public:
   virtual void blah() { cout << "in foo::blah"; }
};

class bar : public foo
{
public:
   virtual void blah() { cout << "in bar::blah"; }
};

void main()
{
   bar* mybar = new bar();
   foo* myfoo = (foo*)mybar;
   myfoo->blah();
}
Reply With Quote