How can I declare constructor for a struct? My struct is declared in the private part of a class and I want to declare my constructor for it.
Below is my code
class Datastructure {
private:
struct Ship
{
std::string s_class;
std::string name;
unsigned int length;
} minShip, maxShip;
std::vector<Ship> shipVector;
public:
Datastructure();
~Datastructure();
};
This my header file; how can I declare constructor for my struct Ship and where do I have to implement that constructor in .h file or in cpp file?
Constructor declared in header file
and implemented in code:
or more likely:
with this in the header: