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 trialHamilton Mtungwazi
1,868 PointsSubclass the SequenceDetector class call the new class RepeatDetector
somebody help me get past this
namespace Treehouse.CodeChallenges
{
class SequenceDetector
{
public virtual bool Scan(int[] sequence)
{
return true;
}
}
public class RepeatDetector : SequenceDetector
{
public override SequenceDetector();
}
}
1 Answer
Steven Parker
231,248 PointsI had trouble passing task 2 with that "public" declaration on the new class, didn't you?
But for task 3, the instructions say to "Override the Scan method", so you might want to start with a copy of that method from the base class with "override" substituted for "virtual". Then, you'll probably use a loop to step through the sequence and compare the adjacent values with each other. If any of them match, return true, but if the loop finishes without finding any you can return false.
Also, notice that another file named RepeatDetector.cs was supplied for use in creating the new class. But you don't need to use it if you prefer working in the first file — it will not affect passing the challenge.