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# Intermediate C# Polymorphism Virtual Methods

Subclass the SequenceDetector class call the new class RepeatDetector

task 2 of 3

SequenceDetector.cs
namespace Treehouse.CodeChallenges
{
    public abstract class SequenceDetector
    {
        public virtual string Description => "";

        public int[] LastScannedSequence { get; protected set; }

        public abstract bool Scan(int[] sequence);
    }
}
RepeatDetector.cs

1 Answer

Steven Parker
Steven Parker
231,275 Points

It looks like you did something for task 1 other than what the instructions asked for. The instructions said "Make the Scan method of the SequenceDetector class virtual.", but the code here shows that it was converted into an abstract instead of virtual, and the class itself was also converted into an abstract.

While this may pass the automated validation for task 1, it means you cannot complete task 2 without also implementing a "Scan" method in the new "RepeatDetector" class.

To have the challenge work as intended, I would suggest starting over with task 1 and perform only the changes in the instructions, and avoid doing anything extra.

You might also want to report the fact that you passed the first task by doing something different to the Support folks. They might want to fix it to prevent students from being confused in the future.