Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- class A {
- public:
- int* p;
- A() {
- p = (int*)malloc(sizeof(int));
- *p = 0;
- }
- /*A(A& other) {
- this->p = (int*)malloc(sizeof(int));
- *(this->p) = *(other.p);
- }*/
- ~A() {
- if (p)
- free(p);
- }
- };
- int main() {
- A a1;
- A a2(a1);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement