Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /******************************************************************************
- Online C++ Compiler.
- Code, Compile, Run and Debug C++ program online.
- Write your code in this editor and press "Run" button to compile and execute it.
- *******************************************************************************/
- #include <iostream>
- using namespace std;
- class MyInt{
- public:
- int my_int;
- MyInt():my_int(0){}
- MyInt(int i): my_int(i){}
- };
- MyInt& returnInt(MyInt& my_int){
- return my_int;
- };
- int& returnPureInt(int& my_int){
- ++my_int;
- return my_int;
- };
- int main()
- {
- MyInt my_10 = MyInt(10);
- MyInt my_11 = returnInt(my_10);
- // MyInt& my_11 = my_10;
- my_11.my_int = 11;
- cout<<"Hello World "<<my_10.my_int<<" "<<my_11.my_int;
- // int pure_int = int(100);
- // int pure_int_2 = returnPureInt(pure_int);
- // ++pure_int_2;
- // cout <<"Hello world " << pure_int <<" "<<pure_int_2;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment