Sign in to follow this  
jmau0438

C2259 - Trouble with Abstract Class

Recommended Posts

jmau0438    134
I'm having trouble with inheriting from an interface-to-abstract class to a template class. (Using VSC++ 2005) I have an interface object, for simplicity we'll call it state and I'll stick to one function, which would go something like this: (This is a hacked example so forgive syntax errors)

__interface iState {

	public:

		virtual void InternalState ( void ) = 0;

}









Then in an abstract interface I define the function signature (notice that I overload it):

template < typename TYPE > class AbstractState abstract : public iState {

	private:

		TYPE _InternalState;

	public:

		virtual void InternalState ( const TYPE Data ) { _InternalState = Data; };

		virtual TYPE* InternalState ( void ) { return _InternalState; };

}








And finally I overload the function calls in a standard template object and intentionally overload the function to avoid this error (even though it should never occur when inherited publicly):

template < typename TYPE > MyState : public AbstractState < TYPE > {

	public:

		void InternalState ( const TYPE Data ) { _InternalState = Data; };

		TYPE* InternalState ( void ) { return _InternalState; };

}









Can anyone tell me where I'm still causing this error?

Share this post


Link to post
Share on other sites
mattd    1078
That example code doesn't help in solving your actual problem - it doesn't match the error you are mentioning.

Can you post the real code in question?
What class are you trying to instantiate?

Share this post


Link to post
Share on other sites
Codeka    1239
In the interface, you've got InternalState that takes no parameters and returns void, but you've not overridden that method in any of the sub classes (you've got one that takes a TYPE and returns void, and one that takes no parameters and returns TYPE*, but neither of those count).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this