Question: what is the difference between a local variable and a data member?
Answer: A local variable is the variable you declare in a function. Its lifespan is on that Function only. A member variable is the variable you declare in a class definition. Its lifespan is inside that class only.It is Global Variable.It can be access by any function inside that same class.