Jump to content

Public section of classes


Tanelxen
 Share

Recommended Posts

When I put things in the private section, I usually end up needing them somewhere else in the engine sooner or later, so I just make everything public. It's based on the assumption the programmer isn't going to go changing random members for fun,

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

It's based on the assumption the programmer isn't going to go changing random members for fun,

ehm.... I'm sorry for what I'm saying now, but your sentence is just bad programming and I bet you know (especially talking about C++ programming) rolleyes.gif

You should never trust the developer who will use the library, it's definitely evil and a robust library will never allow the developer to mess its functions. You should make better use of getter (and setter where appliable) methods if you need access from elsewhere (or protected members to be used in the inherited classes)... ph34r.png

 

PS: notice, I'm not saying you're a bad programmer, I'm saying this particular sentence is very bad programming. However I agree with Tanelxen about this topic.

  • Upvote 1

?? FRANCESCO CROCETTI ??

http://skaredcreations.com

Link to comment
Share on other sites

Well... It's not bad for the developer of engine. He knows how it works. But it can be a nightmare for a programmer who has purchased a license.

How so?

 

I agree with encapsulation as much as possible tough. I think it looks more professional, but everyone is free to use however they want. Take the volume member for instance: You can use SetVolume() and GetVolume, but you might as well just use the Sound.volume member.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...