Im using VCG library I have a private constructor since Trimesh cant be copied in my header file MyProcessing.h
class MyMesh : public vcg::tri::TriMesh< std::vector<MyVertex>, std::vector<MyFace> ,
std::vector<MyEdge> > {
private:
MyMesh(const TriMesh &mesh);
MyMesh operator= (const TriMesh &mesh);
};
And I have a lot of trouble calling it in my MeshProcessing.cpp file What im trying to do is create My mesh in there This is what ive tried
vcg::tri::TriMesh< std::vector<MyVertex>, std::vector<MyFace> , std::vector<MyEdge> > *t_mesh;
MyMesh vcgMesh =MyMesh::MyMesh(*t_mesh);
but compiler is copmplaining abou inaccesible element
Any help how to create it will be appreciated
EDIT1
private:
// TriMesh cannot be copied. Use Append (see vcg/complex/append.h)
TriMesh operator =(const TriMesh & /*m*/){assert(0);return TriMesh();}
TriMesh(const TriMesh & ){}
}; // end class Mesh
Because the given constructor and assignment operator are private, you can only use them within member functions of MyMesh
or its friend classes. You get a compiler error because
MyMesh vcgMesh =MyMesh::MyMesh(*t_mesh);
is not in a member function of MyMesh
or any of its friends.
You will need to make a public constructor or some factory class to solve your problem.
You can't call them outside of the class because you've made them private.
It sounds like you don't want to restrict access, so just make them public :
public:
MyMesh(const TriMesh &mesh);
MyMesh operator= (const TriMesh &mesh);
and provide an appropriate implementation.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.