Last active
May 5, 2018 07:53
-
-
Save jdumont0201/a6e3a9954f04ff727092bed2560d5020 to your computer and use it in GitHub Desktop.
Bad object contruction using new
This file contains hidden or 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
class A{ | |
int d_val; | |
public: | |
A(int val){ | |
d_val=val; | |
} | |
}; | |
int main(){ | |
A * a=new A(5); | |
// ... | |
// exception might be raised | |
// ... | |
delete a; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment