tags:

views:

205

answers:

6

This is the line where the error occurs:

this->_tbfCmdHandler.reset(new Bar()); 

facade_impl.cpp(202): error C2259: 'FOO::Bar' : cannot instantiate abstract class
due to following members:
'void Subscriber::update(T)' : is abstract with
T=char &

observer.h(66) : see declaration of 'Subscriber::update'
with
T=char & 'void Subscriber::update(T)' : is abstract with
T=const char &

observer.h(66) : see declaration of 'Subscriber::update'
with
T=const char & ]

This is the declaration for Facade::Implementation

namespace FOO
{
class Facade::Implementation 
                :public Subscriber<const char& >                     
{

facade.cpp

FOO::Facade::Facade () : impl (new Implementation)
{

    Singleton<SPM::Facade>::instance ();
}


The update functions:
    void update( const char *aMsg)   
    {
        printf("foo");
    }; 

I hope this helps to figure out where I can find the error.

+3  A: 

You have already written your answer. The class is abstract, which means it has pure virtual methods. So, you first have to implement these methods.

frunsi
i thought i've implemented the method with this line:void update( const RecoveryState
Christoferw
Rob Kennedy
Well, the compiler obviously thinks you haven't. Now for us to tell, you will have to show some code.
sbi
+2  A: 

Read up about polymorphism and what an abstract class is.

Abstract means that it is not completely defined yet and therefore, you cannot instanciate that because you don't have all the parts figured out.

It's like trying to start a car without the enginge.

Filip Ekberg
+2  A: 

Try reading this C++ FAQ

Jackson
Linking to outside material is a fine way to start, but you should at least report on what the external material says.
dmckee
A: 

The error says void Subscriber<T>::update(T)' : is abstract with T=char &, so you need to define void update(char&), not just void update( const RecoveryState &dummy){}.

KennyTM
there is also a function for char: void update( char }
Christoferw
+2  A: 

You are inheriting from an abstract class, so you need to implement the void update( const char& ) function inside class Facade::Implementation.

You did define an update function, but it is not related in any way to Subscriber. You have to put it inside your implementation.

Wolf
Christoferw
+1  A: 

This is what the problem solves:

I removed the void update( const char &aMsg), and saw that there was another one "void update( char *aMsg)"

Why this function wasn't reported by the compiler is a miracle... removing the non-const and the Pointer(instead of Reference)-function fixes the problem finally.

Christoferw