Results 1 to 3 of 3

Thread: [RESOLVED] Invalid token in class?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Location
    England
    Posts
    283

    Resolved [RESOLVED] Invalid token in class?

    I am currently trying to learn c# games programming.

    i copied the following code from a book i have bought, and on the marked line it comes up with the error in the title of this thread. Any help as how to sort it?

    c# code:

    public class MainUiScreen : UiScreen, System.IDisposable
    {
    private Microsoft.DirectX.Direct3D.Texture buttonTextures = null;
    private Microsoft.DirectX.Direct3D.Texture messageTexture = null;

    private UiButton newButton = null;
    private UiButton exitButton = null;

    //events
    public event System.EventHandler NewGame;
    public event System.EventHandler Quit;

    #region IDisposable Members
    ///<summary>
    ///clean up in case dispose isn't called
    ///</summary>
    -MainUiScreen() \\it doesn't like the '-' on this line
    {
    Dispose();
    }
    ///<summary>
    ///clean up any resources
    ///</summary>
    ...


    if i remove the '-' it comes up with the error: no overload for method 'uiscreen' takes 0 arguments

    please can someone help??

    Thanks

    GTJ

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Invalid token in class?

    If you're trying to declare a destructor it is supposed start with a "~", not a "-". You should read about destructors.

    http://msdn2.microsoft.com/en-us/library/66x5fx1b.aspx
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Location
    England
    Posts
    283

    Re: Invalid token in class?

    thank you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width