Click here to Skip to main content
15,886,689 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to get the parent proccess's path Pin
raja jamwal31-Dec-09 8:47
raja jamwal31-Dec-09 8:47 
GeneralRe: How to get the parent proccess's path Pin
Bram van Kampen3-Jan-10 23:48
Bram van Kampen3-Jan-10 23:48 
GeneralRe: How to get the parent proccess's path Pin
raja jamwal9-Jan-10 4:06
raja jamwal9-Jan-10 4:06 
GeneralRe: How to get the parent proccess's path Pin
Bram van Kampen9-Jan-10 16:10
Bram van Kampen9-Jan-10 16:10 
Questiongood encapsulation technique ? [modified] Pin
doug2526-Dec-09 10:03
doug2526-Dec-09 10:03 
AnswerRe: good encapsulation technique ? Pin
Jimmanuel26-Dec-09 14:44
Jimmanuel26-Dec-09 14:44 
AnswerRe: good encapsulation technique ? Pin
«_Superman_»26-Dec-09 16:43
professional«_Superman_»26-Dec-09 16:43 
GeneralRe: good encapsulation technique ? [modified] Pin
doug2527-Dec-09 0:05
doug2527-Dec-09 0:05 
Thanks for the comments,

EDIT:

with optimizations turned on, using value = var.var is 1.3 times faster than using a function like value = var.var(). But at millionth's of a second for getting a value 900 million times.

woops, I used an unsigned int for a very big loop, so the value wasn't actually retrieved 900 million times. I recalculated (incrimenting a double for loops) and found that one hundred million value = var.var is 1.0366 times faster than one hundred million value = var.var()

oh, unsigned ints have range 0 to 4,294,967,295

So I guess there isn't much difference in speed using a function to retrieve values. Smile | :)

nevertheless, that was really silly of me, I could easily achieve the same effect as what I originally intended by :

class Class1
{
protected:
//public:
	int var;
}


and then uncomment public: when building a project.

The reason I would want to do this is because to me, protected values should be values that can be read from but not written to (outwidth the class), so when editing using intellisense it's useful for me to see what variables I intend to be protected in the "Let me know when it's ok and when it's not ok to change them" sense.

But I would probably only do this when i'm editing code, otherwise make variables always public if someone else is editing it. see what I mean.

but given that the speed difference of using a get function is so minute, I'll probably start using get functions. though for certain special cases I might want to treat a variable as "protected" but still be able to change it in different scopes so my technique might be useful there.
GeneralRe: good encapsulation technique ? Pin
Cedric Moonen27-Dec-09 1:53
Cedric Moonen27-Dec-09 1:53 
GeneralRe: good encapsulation technique ? Pin
doug2527-Dec-09 2:05
doug2527-Dec-09 2:05 
GeneralRe: good encapsulation technique ? Pin
BonshatS27-Dec-09 3:14
BonshatS27-Dec-09 3:14 
GeneralRe: good encapsulation technique ? Pin
doug2527-Dec-09 6:02
doug2527-Dec-09 6:02 
GeneralRe: good encapsulation technique ? Pin
Bram van Kampen27-Dec-09 12:03
Bram van Kampen27-Dec-09 12:03 
GeneralRe: good encapsulation technique ? Pin
doug2527-Dec-09 13:16
doug2527-Dec-09 13:16 
GeneralRe: good encapsulation technique ? Pin
Bram van Kampen27-Dec-09 14:30
Bram van Kampen27-Dec-09 14:30 
GeneralRe: good encapsulation technique ? Pin
Jimmanuel27-Dec-09 14:39
Jimmanuel27-Dec-09 14:39 
GeneralRe: good encapsulation technique ? [modified] Pin
doug2527-Dec-09 22:52
doug2527-Dec-09 22:52 
GeneralRe: good encapsulation technique ? Pin
doug2528-Dec-09 1:33
doug2528-Dec-09 1:33 
GeneralRe: good encapsulation technique ? Pin
Jimmanuel28-Dec-09 3:05
Jimmanuel28-Dec-09 3:05 
GeneralRe: good encapsulation technique ? Pin
doug2528-Dec-09 3:37
doug2528-Dec-09 3:37 
GeneralRe: good encapsulation technique ? Pin
Bram van Kampen28-Dec-09 13:05
Bram van Kampen28-Dec-09 13:05 
QuestionDisplaying cyrillic alphabet Pin
bhanu_850925-Dec-09 22:22
bhanu_850925-Dec-09 22:22 
AnswerRe: Displaying cyrillic alphabet Pin
Rajesh R Subramanian26-Dec-09 0:13
professionalRajesh R Subramanian26-Dec-09 0:13 
QuestionAssigned value becoam garbage value Pin
Anu_Bala25-Dec-09 20:58
Anu_Bala25-Dec-09 20:58 
AnswerRe: Assigned value becoam garbage value Pin
Nelek25-Dec-09 23:06
protectorNelek25-Dec-09 23:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.