|
-
June 29th, 2009, 09:12 AM
#13
Re: protected member OOP question
 Originally Posted by andrey_zh
It's a violation of the most fundamental OOP rule: Hide as much as you can. It's a rather bad thing when you write a library.
I understand that, but like I said, I don't see how making everything private is beneficial when in most cases you have to make Get/Set functions to get around it anyway.
 Originally Posted by andrey_zh
Consider using preprocessor to make private fields public only on debugging stage of development(1), and generalize your classes(2) - write generalized methods and/or provide a flexible interface.
In most cases all the inheritance hierarchy works as all at once. E.g. when you have a class Vehicle you already know that you need Bike, Car and Ship, but not, say, Plane. So you know what to show and what to hide from derived classes.
Not really sure what you mean. Care to post a code sample?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|