i've never heard of vector iterators, so i chose a) |
Because, of course, you've heard of everything that exists in the world. So if you've never heard of it, it can't possibly exist.
Seriously, it would have taken you less effort to type "C++ vector iterators" into Google than it did to post the question here.
I chose b) cause the [] are empty when i used them in functions |
Really? When you pass multidimensional arrays into functions,
all the brackets are empty? And it compiles?
I chose a) i dont think vectors can carry different elements |
Yeah, that's correct. A vector holds a single data type.
although you specify the type for the vector to hold, you could specify it as void* and then store pointers to different types, so that is why I say both are true |
No, not if you're being precise. If you specify the type as
void*, then type of data you are storing in it are
void* - nothing more. It may be possible to reinterpret (i.e. cast) the values stored in those pointers as pointers to data of other types - but the type stored in the vector is a
void*.
The same is true if you're thinking of polymorphism. If you store base class pointers in a vector, then it's possible to reinterpret those values as pointers to derived class objects, but the type of data actually in the vector is a base class pointer.