There are many issues:
First, make the member functions public:
class Vector { public:
Second,
Vector.vec_add(&v,222);
should be something like
Vector foo; foo.vec_add(v,222);
as you are passing a reference, not a pointer, and you must invoke the member function on an instance, in this case foo, as the member function is not static (think whether you want to make it static, in which case you invoke it as Vector::vec_add). Full working code below:
#include <iostream> #include <vector> #include <algorithm> using namespace std; class Vector { public: // Use user defined template class for vector handling template <class V, class D> void vec_add(V &vec, D data) { vec.push_back(data); } }; int main () { vector<int> v; // v is vecor of int elements Vector foo; foo.vec_add(v, 222); std::cout << v.front(); // test it }
Live on Coliru
A good advice is to pick up a book from here and learn the basic features of the language.