Quote Originally Posted by kunalnandi View Post
member function of Derived class Derived::bar() should be hidden from the derived class object.... and the object of Derived class should called Base::bar() member function...
Are you talking about this?
Qt Code:
  1. #include <iostream>
  2.  
  3. class Base
  4. {
  5. public:
  6. void foo() { std::cout << "Base::foo" << std::endl; }
  7. void bar() { std::cout << "Base::bar" << std::endl; }
  8. };
  9.  
  10. class Derived : public Base
  11. {
  12. public:
  13. void foo() { std::cout << "Derived::foo" << std::endl; }
  14. };
  15.  
  16. int main()
  17. {
  18. Derived d;
  19.  
  20. d.foo();
  21. d.bar(); // <--
  22.  
  23. return 0;
  24. }
To copy to clipboard, switch view to plain text mode 
Output:
Derived::foo()
Base::bar()