What is the difference between these usages: new SubElement() and SubElement()?
Posted
by pocoa
on Stack Overflow
See other posts from Stack Overflow
or by pocoa
Published on 2010-04-02T15:49:13Z
Indexed on
2010/04/02
15:53 UTC
Read the original article
Hit count: 127
Into a class constructor, I need to create some objects on the fly and add them to a vector. Here is my code:
ContainerClass::ContainerClass() {
for (int i = 0; i < limit; i++)
elements.push_back(SubElement());
}
Is this the same thing with new SubElement()? Do I still need to free those SubElement() objects into the ContainerClass destructor?
© Stack Overflow or respective owner