Tuesday, July 28, 2009

How can I use vector as member of class in C++?

I tried use vector as member of class in header file (.h fle):


For example:


class myClass


{


private:


int x;


int y;


vector%26lt;int%26gt;v;


public:


void myFunction();


};


But I received error when compile: error C2143,Error4430....


I dont know why. Can you tell me?Thanks

How can I use vector as member of class in C++?
Did you have #include "vector.h" before the class myClass ?


If you use #include %26lt;vector%26gt;





you should use std::vector %26lt;int%26gt; v;

sending flowers

No comments:

Post a Comment