Sep 11, 2012 at 6:30pm UTC
I just wanted to know a dumb-down version of the difference between the two Private or Public within writing C++/C# code?
Sep 11, 2012 at 6:33pm UTC
One allows member access outside of member function, the other doesn't.
Surely the source who told you that those two existed also told you what they meant?
Sep 11, 2012 at 6:53pm UTC
They are as private and public correspondences.:)
Sep 11, 2012 at 8:13pm UTC
@Athar yeah it does explained in a book that I have been reading and practicing typing C# code with the book is McGraw-Hill ISBN 978-0-07-158830-0, I'm a newbie so just learning a lot of this stuff. My reason for programming is to create applications and program PCB's to do certain things would this be a good language to begin with???
Sep 11, 2012 at 10:43pm UTC
In a nutshell:
A class separates the world into three pieces: things that are that class, things that are not, and things that are somewhere between.
For example, suppose we have a class like this:
double x, y;
If I create a point like this: , then
pt is an instance of the point type.
If I inherit from a point, I get another thing that both is and isn't a point.
So, the question is, who gets to see and play with the x and y members?
Only points and objects that inherit from points.
A very simple rule of thumb might be: You should design your classes so that you only hide things in order to prevent outside stuff from breaking it.
Hope this helps.
Last edited on
Sep 11, 2012 at 10:44pm UTC