Last active
October 8, 2016 14:07
-
-
Save shaunlgs/2db05e4c29dd0e6c57bf0693146bd968 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Program 2.14 | |
#include <iostream> | |
using namespace std; | |
int bil = 0; | |
class UJI | |
{ | |
private: | |
int nilai; | |
public: | |
UJI(int v) | |
{ | |
nilai = v; | |
cout << "\nCreating object with value: " << nilai ; | |
} | |
~UJI() | |
{ | |
cout << "\nDestroying object with value :" << nilai; | |
} | |
void change() | |
{ | |
nilai *= nilai; | |
} | |
}; | |
void external() | |
{ | |
UJI objek1(10), objek2(5); | |
objek1.change(); | |
} | |
int main() | |
{ | |
UJI objek1(3),objek2(7); | |
objek2.change(); | |
external(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment