|
Posted by Curtis on 12/04/06 09:03
> Hi, Curtis,
Hello :)
<snip>
> If these variables are public, you can never change them. But what
> happens if you need to - i.e. for performance? Or accuracy?
<snip>
> Rather, if you encapsulate the longitude and latitude, making them
> private, with accessor functions, the data is not hidden - but the
> implementation is.
I see, I see. All of a sudden, it's like a light bulb turned on in my
head. I have have experience using OOP in PHP, Perl, JavaScript, and
very little in Python and C++, but I am nowhere near an expert,
although I have learned a lot from just trying out code and reading
documentation. There is a lot to OOP I have yet to learn, so I'll try
getting the materials by the experts mentioned. ;)
Just to make sure I interpreted your post correctly:
The benefit of encapsulation is doing things like making certain class
members private, and then utilizing setters/getters so that you can be
much more flexible in changing your class in the future.
Navigation:
[Reply to this message]
|