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 trialAdam Gothmann
4,679 PointsC# interfaces - stuck on defining the class
My code seems correct, but when i try and check my work it says "Did you define a Treehouse.CodeChallenges.Increment class?". What exactly is wrong with my class definition? I have tried using abstract, taking away public, pretty much any option that i have and it doesn't work.
namespace Treehouse.CodeChallenges
{
interface IUnaryOperation
{
double Perform(double value);
}
}
namespace Treehouse.CodeChallenges
{
public class Increment : IUnaryOperation
{
public double Perform(double value)
{
return value++;
}
}
}
1 Answer
Steven Parker
231,198 PointsYou've almost got it.
But .. by using the unary postfix increment operator ("value++
"), you are returning the value prior to incrementing it.
Try incrementing with the prefix operator ("++value
") or with "value += 1
" instead.