vector class guidance

Hi you all.
I'm learning to manage vector class, included on std, through a series of examples I found on the internet.
All of them declares vector<MyClass*> vector; while I was actually expecting vector<MyClass*> *vector;. Does vector declares a pointer within its type?.
What about the function and the statement:

1
2
3
4
5
6
7
8
9
vector<MyClass*> AnotherClass::GetVector()
{
    return vector;
}

...

AnotherClass* anotherClass = new AnotherClass;
vector<MyClass*> aVector = anotherClass->GetVector();


Does the last statement copy the entire vector to aVector variable?.
I think I'm missing something about this class.
I hope you guys help me clarify this.
Thanks in advance.
Does the last statement copy the entire vector to aVector variable?
Yes.
Is there any explanation why all these beginners examples teach us to do it that way? They are supposed to teach us well from the beginning!, aren't they?
Uh... Because whoever wrote them sucks?
Returning a pointer/reference allows the called to assign to a pointer/reference or to make the copy if they want, so unless a newly created vector is being returned, it doesn't make sense deny the called this freedom.
Topic archived. No new replies allowed.