#include <cstdlib>
#include <iostream>
#include <string>
#include <map>
using namespace std;
/*
*
*/
class apple{
private :
int a,b,c,d;
public :
int foo( ) {
return a+ b+ c+ d;
}
} ;
class ball{
private :
map< apple,string> mp;
public :
void foo2( ) {
for ( map< apple,string> :: iterator it = mp.begin ( ) ; it! = mp.end ( ) ; ++ it) {
cout << it- > first.foo ( ) << endl;
}
}
}
int main( int argc, char ** argv) {
return 0 ;
}
I2luY2x1ZGUgPGNzdGRsaWI+CiNpbmNsdWRlIDxpb3N0cmVhbT4KI2luY2x1ZGUgPHN0cmluZz4KI2luY2x1ZGUgPG1hcD4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgovKgogKiAKICovCmNsYXNzIGFwcGxlewpwcml2YXRlOgogICAgaW50IGEsYixjLGQ7CnB1YmxpYzoKICAgIGludCBmb28oKXsKICAgICAgICByZXR1cm4gYStiK2MrZDsKICAgIH0KfTsKY2xhc3MgYmFsbHsKcHJpdmF0ZToKICAgIG1hcDxhcHBsZSxzdHJpbmc+IG1wOwpwdWJsaWM6CiAgICB2b2lkIGZvbzIoKXsKICAgICAgICBmb3IobWFwPGFwcGxlLHN0cmluZz46Oml0ZXJhdG9yIGl0ID0gbXAuYmVnaW4oKTtpdCE9bXAuZW5kKCk7KytpdCl7CiAgICAgICAgICAgIGNvdXQ8PGl0LT5maXJzdC5mb28oKTw8ZW5kbDsKICAgICAgICB9CiAgICB9Cgp9CmludCBtYWluKGludCBhcmdjLCBjaGFyKiogYXJndikgewoKICAgIHJldHVybiAwOwp9
compilation info
prog.cpp:29:1: error: expected ‘;’ after class definition
}
^
prog.cpp: In member function ‘void ball::foo2()’:
prog.cpp:25:33: error: passing ‘const apple’ as ‘this’ argument discards qualifiers [-fpermissive]
cout<<it->first.foo()<<endl;
^
prog.cpp:15:9: note: in call to ‘int apple::foo()’
int foo(){
^~~
stdout