cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
vector as class member
vector as class member
Nov 14, 2011 at 3:11am UTC
targt123
(30)
Is it allowed to have a vector of undefined size as a private member of a class? Can the vector be resized once an instance of that class has been created? How would we make the constructor of such class? Thanks.
Nov 14, 2011 at 3:14am UTC
Athar
(4466)
Is it allowed to have a vector of undefined size as a private member of a class?
If you mean "arbitrary size", then yes.
Can the vector be resized once an instance of that class has been created?
Yes. The structure size of a vector is constant, it gets its storage for its elements from the free store/heap.
How would we make the constructor of such class?
You don't need to do anything special.
Topic archived. No new replies allowed.