c++ - Class of dynamic array -
i've been working on c++ exercise , unable figure out how correctly, let me explain it:
i made class based on 1st question of exercise
class cylinder { private: float height; float radius; char * label; public: cylinder(float, float, char *); cylinder(); cylinder(const cylinder &); ~cylinder(); };
the 2nd question was:
create new class "form3d" contain cylinders (dynamic array of cylinder)
how make default constructor & constructor parameters?
this did:
class forme3d { cylinder * tab; int tabsize; public: forme3d(); forme3d(cylinder * , int); ~forme3d(); }; forme3d::forme3d(cylindre * c, int t) { cylindre * tab = new cylindre[t]; (int = 0; < t; ++i) { tab[i] = c[i]; } }
this cause error "operator=" not defined line "tab[i] = c[i];"
Comments
Post a Comment