fork download
  1. #include <iostream>
  2.  
  3. class A {
  4. private:
  5. class B {};
  6.  
  7. public:
  8. B getB() {
  9. return B();
  10. };
  11. };
  12.  
  13. template <typename T>
  14. struct HideType {
  15. typedef T type;
  16. };
  17.  
  18. HideType<A::B>::type b = A().getB();
  19.  
  20. int main() {
  21. return 0;
  22. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:5:11: error: 'class A::B' is private
     class B {};
           ^
prog.cpp:18:1: error: within this context
 HideType<A::B>::type b = A().getB();
 ^
stdout
Standard output is empty