educative.io

Why do we need 2 member variables?

The functions don’t use the member variables. Why should we add them to the class?


Type your question above this line.

Course: https://www.educative.io/collection/10370001/5754868253851648
Lesson: https://www.educative.io/collection/page/10370001/5754868253851648/6309853570007040

Hi @Pablo_Zoani

The inputs to the member functions add, subtract etc. are first stored in the member variables num1 and num2 before being used. We can also implement this without any member variables, both are correct approaches.