I have a question about the following main
#include "Pokemon.h"
int main()
{
Pokemon piplup("Piplup", Pokemon::Agua);
piplup.mostrar();
cout << endl << endl;
}
I must say that the main is a reference that the teacher passed us to use the classes. My question is about the first line, the constructor's parameter Pokemon::Agua
, if I'm not mistaken, it refers to a member variable, that is, water.
However, I'm lost when I do the pokemon class, since in the exercise instructions it says that every pokemon has a name and can only be of four types, water, earth, air and fire . In addition to the methods that I did, then the header, there must be one to get a string with the name of the type given the type code and if necessary include constants in the pokemon class .
I have the class like that, but I do not understand how to implement the constructor so that from the main it is called as the reference main
#ifndef POKEMON_H
#define POKEMON_H
#include <string>
using std::string;
class Pokemon
{
string nombre;
string tipo;
public:
string getTipo ();
//Constructores
Pokemon();
Pokemon (string nombre, string tipo);
~Pokemon();
//Metodos de acceso
string getNombre ();
string getTipo (string tipo);
void setNombre (string nombre);
void setTipo (string tipo);
//Metodo utilitario
void mostrar ();
};
#endif
If you can help me, I would really appreciate it!