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

Ahmed M
Ahmed M
4,008 Points

error CS0246

Game.cs(15,25): error CS0246: The type or namespace name `MapLocation' could not be found. Are you missing an asse mbly reference? https://w.trhou.se/x7o6nubmd4

2 Answers

Okay, I'm sorry. I had a short recap of your code again.

The issue was not because it wasn't public, but it was because there is a typo in the method MapLocation within that class. The code says Maplocation instead of MapLocation.

Try to change it back to this:

using System;

namespace TreehouseDefense
{
    class Maplocation : Point
    {
        public MapLocation(int x, int y) : base(x, y)
        {

        }
    }
}

You need to make your MapLocation class public.

namespace TreehouseDefense
{
    public class Maplocation : Point
    {
        public Maplocation(int x, int y) : base(x, y)
        {

        }
    }
}
Ahmed M
Ahmed M
4,008 Points

i did it now it doing this MapLocation.cs(5,18): error CS0060: Inconsistent accessibility: base class TreehouseDefense.Point' is less access ible than classTreehouseDefense.Maplocation'

code https://w.trhou.se/kdrj8vrhjg

Ahmed M
Ahmed M
4,008 Points

i did it! thank you ;)