class mycls {int a,b; public: mycls(int m, int n) {a=m; b=n;} friend int Fn(mycls ob); }; int Fn(mycls ob) {mycls=temp; temp.a=temp.a*temp.a; temp.b=temp.b*temp.b; return temp; } int main() {mycls ob1(10,13), ob2(0,0); ob2=Fn(ob1); return 0; } /*---------------------*/ class mycls {int a,b; public: mycls(int m, int n) {a=m; b=n;} friend int Fn(mycls ob); }; int Fn(mycls ob){return a+b;} int main() {mycls ob1(10,15); int res; res=Fn(ob1); return 0; } /*---------------------*/ class mycls {int a,b; public: void set(inti, int j) {a=i; b=j;} void show() {cout< {MyCls ob1; YourCls ob2; ob1.set(10,5); ob2=ob1; ob1.show(); ob2.show();} 765.cpp: In function ‘int Fn(mycls)’: 765.cpp:8: error: expected unqualified-id before ‘=’ token 765.cpp:9: error: ‘temp’ was not declared in this scope 765.cpp: In function ‘int main()’: 765.cpp:15: error: no match for ‘operator=’ in ‘ob2 = Fn(ob1)’ 765.cpp:1: note: candidates are: mycls& mycls::operator=(const mycls&) 765.cpp: At global scope: 765.cpp:23: error: redefinition of ‘class mycls’ 765.cpp:1: error: previous definition of ‘class mycls’ 765.cpp: In function ‘int Fn(mycls)’: 765.cpp:28: error: redefinition of ‘int Fn(mycls)’ 765.cpp:6: error: ‘int Fn(mycls)’ previously defined here 765.cpp:28: error: ‘a’ was not declared in this scope 765.cpp:28: error: ‘b’ was not declared in this scope 765.cpp: In function ‘int main()’: 765.cpp:30: error: redefinition of ‘int main()’ 765.cpp:13: error: ‘int main()’ previously defined here 765.cpp: At global scope: 765.cpp:42: error: redefinition of ‘class mycls’ 765.cpp:1: error: previous definition of ‘class mycls’ 765.cpp:152: error: expected unqualified-id at end of input /*-----------------------*/ class NAME {}; //в конце класса должна стоять точка с запятой 44 строка - int i было написанно слитно. Сверху выдача ошибок компилятора. смотрите четко по ней.