General questions for C++

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
3. Yes a class destructor is generally used to free memory.

I don't quite get the first two questions.



Thanks for helping =)
Last edited on
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?
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.