2022 - Challenge

From TRCCompSci - AQA Computer Science
Jump to: navigation, search

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.

The all seem to be accessor methods for the protected variables and structures.