1// Build don't link: 2// GROUPS passed ARM-compliance 3#include <iostream> 4enum f1 { 5 F1 6}; 7 8enum f2 { 9 F2 10}; 11 12class A { 13public: 14 void set (f1 f); 15}; 16void A::set (f1 f) { std::cout << "called A f1\n";} 17 18class B : public A { 19public: 20 void set (f2 f); 21}; 22void B::set (f2 f) { std::cout << "called B\n";} // ERROR - candidate 23 24int main() { 25 B b; 26 b.set(F1); // ARM page 309: should call A.set(f1) and that what g++ does,// ERROR - .* 27 // but 13.1 of ARM clearly states that it should call B::set() 28 // or generate an error because overloading works only for 29 // functions within the same scope (first page of chapter 13) 30 // while member of derived and base classes are considered to 31 // belong to different scopes. Thus B::set() should have 32 // hidden (completely) the A::set() function. 33} 34 35 36 37 38 39