Solution Review: Implement a Calculator Class
This review provides a detailed analysis to solve the 'Implement a Calculator Class' challenge.
We'll cover the following...
We'll cover the following...
Solution
Explanation
-
Line 4-5: We have implemented the
Calculatorclass which has the fields_num1and_num2. -
Line 8-11: In the constructor, we have initialized both fields to num1 and num2.
-
Line 14-16: Implemented
Add(), a method which returns the sum of two numbers, i.e., ...