Difference between revisions of "2022 - Challenge"
(Created page with "=The Code= <syntaxhighlight lang=c#> class Challenge { protected List<string> Condition; protected bool Met; public Challenge() {...") |
(No difference)
|
Revision as of 12:49, 23 December 2021
Contents
The Code
class Challenge
{
protected List<string> Condition;
protected bool Met;
public Challenge()
{
Met = false;
}
public bool GetMet()
{
return Met;
}
public List<string> GetCondition()
{
return Condition;
}
public void SetMet(bool newValue)
{
Met = newValue;
}
public void SetCondition(List<string> newCondition)
{
Condition = newCondition;
}
}
Variables
The class defines a List of strings called Condition. This is protected, which means it is available in any subclass created from Challenge.
The class also defines a boolean called 'Met'. This is also protected.
The Constructor
The constructor method only sets the Met boolean to false.
Methods
Interestingly, none of the methods within this class are declared as virtual. This means they can't be overridden in any subclass.