Reputation: 297
I've been trying to get a Awesomium::WebViewListener working, but whenever I try to allocate the Listener object I get a "Field type 'Listener' is an abstract class" error.
Here's my code:
class Listener : public Awesomium::WebViewListener
{
public:
void onCallback(Awesomium::WebView* caller,
const std::wstring& objectName,
const std::wstring& callbackName,
const Awesomium::JSArguments& args)
{
std::cout << "Hello!" << std::endl;
}
};
// In the GUI class
Listener listener; // Field type 'Listener' is an abstract class
view->setListener(&listener);
How am I supposed to set the listener if I can't allocate a Listener-object? I've tried using boost::shared_ptr which doesn't produce any errors but the onCallback()-function never gets called.
Upvotes: 0
Views: 488
Reputation: 5054
It could be two variants:
Awesomium::WebViewListener
contains more then one abstract method. If so - you should implement them all to create an instance of derived class `Listener' (bash.d said about it)Awesomium::WebViewListener::onCallback
arguments list should be exatly equal to your's one. If not so, then you added this method to Listener
, but not implemented base abstract onCallback
Upvotes: 1