 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Mon Nov 27, 2006 10:10 am Post subject: static storage class error. |
|
|
Hello Group,
Please go through the program below:
RatingComponent.h
=================
class RatingComponent
{
public:
static RatingComponent & getInstance();
protected:
private:
static RatingComponent * _instance;
RatingComponent(); // We're a singleton
};
RatingComponent.cpp
===================
static RatingComponent * RatingComponent::_instance = 0;
RatingComponent & RatingComponent::getInstance()
{
if ( 0 == RatingComponent::_instance )
{
RatingComponent::_instance = new RatingComponent();
}
return *(RatingComponent::_instance);
}
I am getting an error:
Error 566: "RatingComponent.cpp", line 13 # static class member
"RatingComponent *RatingComponent::_instance" may not have
this storage class.
I am using aCC 3.65 compiler from HP. The curious thing is, when i use
older version of aCC 3.55, i am not getting this
error. Any help is greatly apprecited and thanks in advance.
Cheers
Shan |
|
| Back to top |
|
 |
Gianni Mariani Guest
|
Posted: Mon Nov 27, 2006 10:10 am Post subject: Re: static storage class error. |
|
|
shan_rish (AT) yahoo (DOT) com wrote:
....
| Quote: | RatingComponent.cpp
===================
static RatingComponent * RatingComponent::_instance = 0;
^^^^^^^^^ |
loose the "static" here.
> |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|