1 2 3 4 5 6 7 8 9 10 11 12 | class Foo { public: const int SomeFunction() { return iValue; } private: int iValue; }; int main() { Foo * foo = new Foo() ; foo->SomeFunction()->AnotherFunction(); return 0; } |
Y2xhc3MgRm9vIHsKcHVibGljOgogIGNvbnN0IGludCBTb21lRnVuY3Rpb24oKSB7IHJldHVybiBpVmFsdWU7IH0KcHJpdmF0ZToKICBpbnQgaVZhbHVlOwp9OwoKaW50IG1haW4oKSB7CiAgRm9vICogZm9vID0gbmV3IEZvbygpIDsKICBmb28tPlNvbWVGdW5jdGlvbigpLT5Bbm90aGVyRnVuY3Rpb24oKTsKICByZXR1cm4gMDsKfQ==
prog.cpp: In function ‘int main()’: prog.cpp:10: error: base operand of ‘->’ is not a pointer
-
result: Compilation error (maybe you wish to see an example for C++ 4.7.2)


