General questions for C++

Jun 6, 2013 at 5:33am
I have three statements that I believe are true. Though I am not 100% certain that I am correct.
Could someone provide some feedback and/or thoughts? Thanks in advance =)

Last edited on Jun 6, 2013 at 5:41pm
Jun 6, 2013 at 6:30am
3. Yes a class destructor is generally used to free memory.

I don't quite get the first two questions.
Jun 6, 2013 at 6:39am



Thanks for helping =)
Last edited on Jun 6, 2013 at 5:41pm
Jun 6, 2013 at 7:55am
I wasnt sure if returning a value is an absolute condition for Recursion
The return value of the recursion is usually not used as a condition, but that doesn't mean you can't

-A replicator not a class function type.
what is a replicator?
Jun 6, 2013 at 9:18am
by replicator you probably mean copy constructor, and each class has a default copy constructor which simply assignes by value all the fields. If you want a different one then you need to make one yourself.

about recursion, then the basic recursions probably do return something.
but not necessarly, you might be working on some globals.

destructor needs to dealocate any memory that you allocated inside the class.
which means that if you did Somthing something = new Something() in your constructor,
then you probably need to do delete something; in your destructor, unless you still want to use it, after the object has been destroyed
Topic archived. No new replies allowed.