The Mesh class contains all the necessary functions for working with models. The Box and Sphere classes are inherited from it, while having their own constructors.
class Mesh { public: void move(float x,float y,float z) { ... } void turn(float x,float y,float z) { ... } void flip() { ... } void setTexture(char filename[]) { ... } void setSize(float x,float y,float z) { ... } }; class Box : public Mesh { public: Box(float x,float y,float z) { ... } }; class Sphere : public Mesh { public: Sphere(float x,float y,float z, int segments) { ... } };
The fact is that now I need to write a constructor for Mesh, which will load 3D models, but when I write something like that in Mesh
Mesh(float x,float y,float z,char filename[]) { ... }
The compiler throws the error "no default constructor exists for class". If you add an empty Mesh () constructor; then an error occurs
error LNK2001: unresolved external symbol "public: __thiscall Mesh::Mesh(void)" (??0Mesh@@QAE@XZ)