fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Foo {
  5. const char* n;
  6. public:
  7. Foo() : n("Hi") {}
  8. const char* bar(const char* p = n) { return p; }
  9. };
  10. int main() {
  11. // your code goes here
  12. return 0;
  13. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:8:34: error: invalid use of non-static data member 'Foo::n'
  const char* bar(const char* p = n) { return p; }
                                  ^
prog.cpp:5:14: note: declared here
  const char* n;
              ^
stdout
Standard output is empty