Archived

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

public, private and protected ...

This topic is 5623 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

essentialy, is their a speed diffenece ?? eg. say i have a var, and it public, but dosnt need to be, if i make it private or protected, is their ANY preformace gain ?? also, what are the key differences ... thanx.

Share this post


Link to post
Share on other sites
No. It''s just a compile-time thing.
A bit like the stop signs on roads, it doesn''t actually make you stop, but it tells you it''s probably a good idea to stop

Public: anything outside or inside your class can see it.
Protected: inside your class or classes derived from it you can see it.
Private: only inside the class itself can you see it.

Share this post


Link to post
Share on other sites
i need a way of not sending unneeded variables through the memory (im creating a engine independent directx renderer and an opengl one) so stuff like vertexbuffer pointers and such dont need to be there

thanx

Share this post


Link to post
Share on other sites
In order to do that, you''re going to have to do a lot more work. I don''t really understand the situation you''re trying to model though... are you trying to make a class that can do both, but that doesn''t take up the memory of the side that you aren''t using?

Share this post


Link to post
Share on other sites