Sign in to follow this  
Kuam

Trouble with Direction and get

Recommended Posts

Hey everyone,

Having some trouble with a particular part of code. I'm working on creating various classes for user-directed and automated sprite movement. I have created a class [i]Sprite[/i] that I'm working in. I have other classes [i]AutomatedSprite[/i] and [i]UserControlledSprite[/i].

I put the following code in my [i]Sprite[/i] class:

[CODE]
public abstract Vector2 direction
{
get;
}
[/CODE]

I go on to define the [i]get [/i]in the above mentioned classes. However, when I try to compile, I get the error for this particular piece of code:

[b]'AnimatedSprites.Sprite.direction.get' is abstract but it is contained in non-abstract class 'AnimatedSprites.Sprite'[/b]

I'm working out of [u]Learning XNA 4.0[/u] and I thought I was supposed to put it in this class. I'm not sure where else to put it. I tried putting it in my first Game1.cs class, but that didn't work either. Stumped. Any help is appreciated.

[b]EDIT:[/b] Figured it out. Missed where I needed to make the class Sprite abstract. I tried it, but I put the abstract on the wrong side of [i]class[/i] causing an error. Definitely kick the programmer on this one. I hope this helps someone else learn from my mistake. Edited by Kuam

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