[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

inheritance scope

From: Gav
Subject: inheritance scope
Date: Fri, 26 Nov 2004 17:32:39 +0000
User-agent: KNode/0.8.1


could someone tell me why this program (which results in a compilation
error) shouldn't compile (i.e. is it a gcc thing or is it a strict part of
c++), and how i can make it compile without having to put C:: before foo()
in main()?

essentially i want the foo() from A to be overloaded as i would expect if it
was actually inserted into C.

thanks, gav

#include <iostream>
class A
{  public: void foo() { std::cerr << "A::foo(int)" << std::endl; }
class C : public A
{  public: void foo(int) { std::cerr << "C::foo(int)" << std::endl; }
} c;
int main()
   return 0;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]