1234567891011121314151617181920212223242526
// my first program in C++ #include <iostream> class Foo { void hello() const { std::cout << "Hello Dolly!\n"; } public: struct Bar { void hello(int x) const { std::cout << "Hello " << x << " World!\n"; } void hello( const Foo& f ) const { f.hello(); } }; }; int main() { Foo::Bar a; a.hello( 1 ); Foo b; a.hello( b ); }
Hello 1 World! Hello Dolly!