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 Throwing Exceptions

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there, Tojo Alex! You're doing fine, but you missed a tiny part in the declaration of the constructor for the MapLocation. You might have noticed the error "Treehouse.Defense.MapLocation' does not contain a constructor that takes '3' arguments". The reason that you are getting this is because when you are later creating your instance of MapLocation you are sending in 3 arguments to get it all set up. But in your declaration you forgot that it takes two integers and an instance of Map.

In your MapLocation.cs file you wrote:

public MapLocation(int x, int y): base(x, y)

But that should be:

public MapLocation(int x, int y, Map map): base(x, y)

Note how the second variant contains a Map parameter as well.

Hope this helps! :sparkles: