public, private and protected ...

Started by
2 comments, last by silvermace 21 years, 9 months ago
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.
"I am a donut! Ask not how many tris/batch, but rather how many batches/frame!" -- Matthias Wloka & Richard Huddy, (GDC, DirectX 9 Performance)

http://www.silvermace.com/ -- My personal website
Advertisement
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.
It's only funny 'till someone gets hurt.And then it's just hilarious.Unless it's you.
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
"I am a donut! Ask not how many tris/batch, but rather how many batches/frame!" -- Matthias Wloka & Richard Huddy, (GDC, DirectX 9 Performance)

http://www.silvermace.com/ -- My personal website
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?
It's only funny 'till someone gets hurt.And then it's just hilarious.Unless it's you.

This topic is closed to new replies.

Advertisement