Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- class kelasku
- {
- int x;
- public:
- kelasku() { x = 135; }
- cetak() { std::cout << x << std::endl; }
- };
- int main()
- {
- kelasku obj1;
- kelasku *obj2;
- obj2 = (kelasku*) malloc(sizeof(kelasku));
- obj1.cetak();
- obj2->cetak();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement