Hi, I have a few questions.
I understand how to create basic classes, performing very basic tasks.
I know I should make data members private and member functions public.
I know how to use accesor and mutator methods to retrieve info or change the value of data members.
I kind of understand how to use a constructor.
What i dont understand is the concept behind these!
I do not understand why I should make data members private, so that they can only be accessed by member functions. Is this done for security?
Can someone explain that to me.
Also I do not understand why it is important to use contructors, as far as I know, the purpose of a constructor is to initialize data members inside a class.
But what if I want the value of the data members to be inputted by the user?
Do I still require a constructor?
Can someone explain that concept to me?
Thanks, sorry for teh long post