Original Post
Hey guys,
I got this set of code for a singleton class and I am getting compile errors and I am not what the problem is...
If you can look and tell me what I did wrong I be very happy
[color="#0000ff"][color="#0000ff"]
[color="#0000ff"][color="#0000ff"]
[color="#0000ff"][color="#0000ff"]#include [color="#a31515"][color="#a31515"]"Sky_Singleton.h"
Sky_Singleton* Sky_Singleton::instance_sky_singleton = NULL;
Sky_Singleton::Sky_Singleton()
{}
Sky_Singleton *Sky_Singleton::getInstance()
{
[color="#0000ff"][color="#0000ff"]if( instance_sky_singleton == NULL )
instance_sky_singleton = [color="#0000ff"][color="#0000ff"]new Sky_Singleton();
[color="#0000ff"][color="#0000ff"]return instance_sky_singleton;
}
[/source]
Error I am getting is something like this
I got this set of code for a singleton class and I am getting compile errors and I am not what the problem is...
If you can look and tell me what I did wrong I be very happy
[color="#0000ff"][color="#0000ff"]
#ifndef SKY_SINGLETON_H
#define SKY_SINGLETON_H
#include <d3d9.h>
#include <d3dx9.h>
#include "Skydome.h"
class Sky_Singleton
{
public:
Sky_Singleton *getInstance();
private:
Sky_Singleton();
static Sky_Singleton *instance_sky_singleton;
SpaceObject *skydome;
};
[color="#0000ff"][color="#0000ff"]#endif
[color="#0000ff"][color="#0000ff"]
[color="#0000ff"][color="#0000ff"]#include [color="#a31515"][color="#a31515"]"Sky_Singleton.h"
Sky_Singleton* Sky_Singleton::instance_sky_singleton = NULL;
Sky_Singleton::Sky_Singleton()
{}
Sky_Singleton *Sky_Singleton::getInstance()
{
[color="#0000ff"][color="#0000ff"]if( instance_sky_singleton == NULL )
instance_sky_singleton = [color="#0000ff"][color="#0000ff"]new Sky_Singleton();
[color="#0000ff"][color="#0000ff"]return instance_sky_singleton;
}
[/source]
Error I am getting is something like this
[size="1"]error C2556: 'int *Sky_Singleton::getInstance(void)' : overloaded function differs only by return type from 'Sky_Singleton *Sky_Singleton::getInstance(void)'
[/quote]
Thanks guys... been stuck on this for few hours.
P. S.and source tags no longer work?