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 trialBenson Gathee
Courses Plus Student 1,280 PointsDoes Increment have a constructor that takes no parameters? What is this error?
In Increment.cs create a class named Increment that implements the IUnaryOperation interface. The Perform method should increment the value passed in by one.
namespace Treehouse.CodeChallenges
{
interface IUnaryOperation
{
double Perform(double value);
}
}
namespace Treehouse.CodeChallenges
{
abstract class Increment : IUnaryOperation
{
public Increment(){}
public double Perform(double value)
{
return value+=1;
}
}
}
1 Answer
Steven Parker
231,269 PointsThat message is perhaps a bit misleading. The constructor is not the issue.
But the instructions did not say anything about creating an abstract class. Abstract classes cannot be instantiated, which is most likely how the challenge tests the code.