Jump to content
  • Advertisement
Sign in to follow this  
jmau0438

C2259 - Trouble with Abstract Class

This topic is 3079 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!