Question: 2 . 2 You are designing a security system for a high - security facility. The system requires SecurityCode class that manages sensitive access codes.
You are designing a security system for a highsecurity facility. The system requires SecurityCode class that manages sensitive access codes. To ensure the integrity of the system, the SecurityCode class should not be inherited or extended. The class should have properties Code and IsActive, and a method DeactivateCode that sets the code's IsActive property to false.
Requirements:
a Define the SecurityCode class as a sealed class with properties Code and IsActive.
b Create a constructor that initializes the Code property and sets IsActive to true by default.
c Implement the DeactivateCode method, which sets IsActive to false.
d Create an instance of the SecurityCode class, and test the DeactivateCode method by printing out whether the code is active before and after calling the method.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
