Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

cclements

In General: member functions public vars private?

This topic is 6041 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
it is.... trust me... it''s like a standard or something....I''m not really a Object oriented programmer but I have always read that it is best to do so.


Dark Star
UK

Share this post


Link to post
Share on other sites
Only declare member functions that will be called outside your class as public. For any member functions that will only used internally by your class declare as private.

All member variables should be declared as private. If those outside your class need to have access to certain variables then create public accessor functions (Get/Set functions) as needed for those variables. You can inline those accessors for classes where speed is critical.

This is the general accepted way to create classes and is called black-boxing.


- Houdini

Share this post


Link to post
Share on other sites
quote:
Original post by Houdini
All member variables should be declared as private.


Not everyone programs with this as a rigid rule, but in general you should make properties private



Magmai Kai Holmlor

"Oh, like you''ve never written buggy code" - Lee

"What I see is a system that _could do anything - but currently does nothing !" - Anonymous CEO

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!