View Single Post
Old 10-06-2007, 12:21 AM   #1 (permalink)
markster
Code Monkey
 
markster's Avatar
 
Join Date: Jun 2006
Posts: 65
markster is on a distinguished road
Unhappy Total Beginner Question: Problems with classes

Hi. I've declared a class in my file and I want to use it within another class. So far i have this:

Code:
public class song
    {
        static public string track;
        static void Note(string note, string durr)
        {
            track += note+"*"+durr+"|";
        }
        static void Play()
        {
            if (track.Length > 0)
            {
                // Some stuff
            }
        }
    }
and I'm trying to use it like this:

Code:
myTune;
myTune = new MyNamespace.song();
I get the error that 'myTune' doesn't exist in the current context.

What am I doing wrong?
__________________
Stuff4Web.co.uk - The ultimate resource for webmasters

50% off all orders £1-£50! Just enter the code AGSIG01 at the checkout! Offer ends: 01/09/2008
markster is offline   Reply With Quote