I am working my way through the C# tutorials on this site, and I am getting stuck on this exercise. I got stuck on 5.1 and a C# programmer I work with discovered that the issue was a freaking space. It's making it hard to see if I am getting the concepts right or not. He said the space issue would never cause an issue compiling in reality, so it may be a bug in the validator on the site.
Anyway, I am on exercise 7.1 here: dotnetacademy exercise 7.1 and I can't seem to get code to validate properly. the steps are as follows:
This is the code I wrote up:
using System;
// Implement your classes here.
public abstract class Astrodroid
{
public virtual string GetSound { get { return "Beep beep"; } }
public void MakeSound()
{
Console.WriteLine(GetSound);
}
}
public class R2 : Astrodroid
{
public override string GetSound { get { return "Beep bob"; } }
}
public class Program
{
public static void Main()
{
//var MakeSound = new R2();
//Console.WriteLine(MakeSound.GetSound);
}
}
The error I get is this:
Not all requirements have been met.
You must define a method named GetSound that returns a string.
Can anyone help me figure out what I'm doing wrong?
You defined GetSound
as a property, not a method.
public override string GetSound() { return "Beep bob"; }
is what you wanted.