Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- // Class
- class Swap{
- public:
- void jason(int x);
- };
- void Swap::jason(int x){
- //x = 200;
- cout << "Jason_val = " << x << endl ;
- }
- // Function without Class
- void lee(int y);
- void lee(int y){
- y = 200;
- cout << "Lee_val = " << y << endl ;
- }
- // Main Function
- int main(void){
- string val = 20;
- cout << "Origin_val = " << val << endl;
- Swap sp;
- sp.jason(10);
- lee(100);
- cout << "InMain_val = " << val << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment