I have this c# code:
class Animacion
{
private static Animacion instancia;
public static Animacion Instance
{
get
{
if (instancia == null)
{
instancia = new Animacion();
}
return instancia;
}
}
I want to convert that code to c++, I tryed to use a code converter from tangible software solutions and I got this:
//.h file code:
class Animacion
{
private:
static Animacion *instancia;
public:
static Animacion *getInstance() const;
};
//.cpp file code:
Animacion *Animacion::getInstance() const
{
if (instancia == nullptr)
{
instancia = new Animacion();
}
return instancia;
}
When I use the code generated from the converter I get errors like:
error: C2272: 'getInstance' : modifiers not allowed on static member functions
can anyone help me?