What is the ~ used for?

I am currently reading a book on coding and they use ~ quite often without ever explaining what it is for. It is usually used to repeat the same exact function twice in a row, and usually within a class, in the public part. I'll just make it a very general code for an example.

public:
className(void)
~className(void)
The function with the same name as the class and no return type is the constructor. The one with the tilde is the destructor. I'm assuming you can find plenty of information on Google now that you know the name for it ;)
Last edited on
Alright thank you. That actually does help a lot
If it isn't explaining even that, then its probably not a good book.
Topic archived. No new replies allowed.