Initializing Object Do's And Don'ts

closed account (365X92yv)
What are some bounds when creating objects? I'd like to use a method to create an object. I've also been thinking that I should think about using a pointer to create one. Any ideas?
Do remember to initialize a variable before first use
Don't create a variable with a pointer and the new keyword, then forget to delete it later.
closed account (zb0S216C)
This one isn't really a do or don't. There's no point in allocating an int because the stack can easily hold it. Only allocate large objects, such as those with a size of 16-bytes or higher.

Wazzak
Last edited on
closed account (365X92yv)
Here's a for instance....

Say I want to pass a timer object, with public data members for minutes and seconds and a string, into a method that takes the object, checks the string for something, and then I would like to create a new timer object with the timer so I can pass both objects into a new function to add them.

How would I go about doing that?
Topic archived. No new replies allowed.