On 2/14/07, Gopi Krishna Komanduri <[EMAIL PROTECTED]> wrote:
>
>    Hi Frnds,
>                  Why overloaded operator won't work for derived calss when we 
> supply
> operator overloading method in base class and also we derived using  public. 
> Can any
> one of you please suggest.

Can you supply code to demonstrate what you're trying to do? Your
explanation isn't too clear:

#include <iostream>

class base {
public:
   void foo(){ std::cout << "base::foo()\n"; }
   virtual void bar() { std::cout << "base::bar()\n"; }
};

class derived : public base {
public:
   void foo(){ std::cout << "derived::foo()\n"; }
   virtual void bar() { std::cout << "derived::bar()\n"; }
};

int main(){
   base* b;
   b = new derived;

   b->foo(); // base::foo() expected - what you're seeing?
   b->bar(); // derived::bar() expected - what you want?

   return 0;
}


-- 
PJH
Aio, quantitas magna frumentorum est

Reply via email to