Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C# C# Objects Inheritance Inheritance in Code

dsteelz
dsteelz
1,203 Points

code wont work (with snapshots)

i've been following along ever since the video began. now my code won't work and i have no clue why. when I compile Point class, it says I'm missing a main method. when i compile the MapLocation class, it says that the class I'm inheriting from (Point) does not exist. when i compile in Game class, it says that I'm missing a bunch of assembly references. lastly, when i try to compile every file at once, it says that that "TreehouseDefense is a binary file and not a text file" and "file .cs doesn't exist"

https://w.trhou.se/8m7z3md1hu my workspace

Danyiell Eckric
Danyiell Eckric
1,923 Points

In Game class you have the code Point point = new Point(); and that is right but when you use it in Console.WriteLine(point.DistanceTo(5,5)) you actually have an uppercase P in point. This should be lowercase.

See if that fixes your issue..

Also on your compilation problem make sure you have the whole thing correct: mcs -out:TreehouseDefense.exe *.cs && mono TreehouseDefense.exe

I hope that helps. :)

1 Answer

Steven Parker
Steven Parker
229,785 Points

You might be using the wrong command to build.

Try using this command to build your program :point_right: mcs *.cs
Then this command to run the program :point_right: mono TreehouseDefense.exe

Also, you have a typo on line 15 of Game.cs where instead of "point" (lower-case "p") you have "Point" (capital "P").

I also answered the other copy of this same question.