I'm new to C#. In fact, I've only been screwing around with it for a few hours.
I'm trying to make an array of classes, but I can't seem to get it right. Code is:
It compiles, but bombs out when it hits a line that accesses the object.Code:class CMovieList { private string strMovieName; private double dAmountMade; public void setValues(string m, double a) { strMovieName = m; dAmountMade = a; } public string getMovie() { return strMovieName; } public double getAmount() { return dAmountMade; } } class Class1 { static void Main(string[] args) { CMovieList[] cMovies = new CMovieList[1]; cMovies[0].setValues("Movie Name", 120000.0); Console.WriteLine("The movie is: " + cMovies[0].getMovie()); } }




Reply With Quote