fork download
  1. #include<iostream>
  2.  
  3. struct Base {
  4. void foo() {
  5. std::cout << "Base::foo()\n";
  6. }
  7.  
  8. Base& operator = (const Base&)
  9. {
  10. std::cout << "Base::operator =\n";
  11. return *this;
  12. }
  13. };
  14.  
  15. struct Derived : Base {
  16. private:
  17. using Base::foo;
  18. using Base::operator =;
  19. };
  20.  
  21. int main () {
  22. Derived d1, d2;
  23. d1 = d2; // ok !!
  24. //d1.foo(); // error
  25. }
  26.  
Success #stdin #stdout 0s 2896KB
stdin
Standard input is empty
stdout
Base::operator =