Templates + inheritance + virtual functions

Code..
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
	template<class T>
	class AbstractFactory
	{
	public:
		virtual ~AbstractFactory() {}
		virtual T* Create(uint32 type) const = 0;
		virtual bool CanCreate() const = 0;
	};

        class DefaultFactory : public AbstractFactory<Widget*>
	{
	public:
		DefaultFactory();
		Widget* Create(uint32 type) const;
		bool CanCreate(uint32 type) const;
	};

Errors:

error C2555: 'gui::DefaultFactory::Create': overriding virtual function return type differs and is not covariant from 'gui::AbstractFactory<T>::Create'


Any idea on how to fix it?

Edit: Fixed.. class DefaultFactory : public AbstractFactory<Widget>
Last edited on
Topic archived. No new replies allowed.