Click here to Skip to main content
15,881,715 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
thanks for the feedback.

well, I think your right. It would be better to just implement get and set functions rather than what I've been doing.

The only possible draw back is speed, but there might not be any difference (I think it's just my own paranoia getting to me).

Superman suggested I could check the assembly output, does this mean the assembly code that is produced when code is compiled to read a variable from a get function and read a variable directly ? I don't know how to check the assembly output or what part of it to examine ?
Ok, the assembly / machine code output of variable = instance.getVar() is not the same as variable = instance.var

I took timed measurements (optimizations on), reading from a variable directly seemed faster than using a function, but I'll reimplement the code for my actual project and see if there's a noticable difference in speed. If there isn't then I think I'll have to agree that in 99.99% or 100% of cases, it would be better to use the standard method.

modified on Monday, December 28, 2009 5:39 AM

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 
GeneralRe: Assigned value becoam garbage value Pin
Anu_Bala27-Dec-09 16:31
Anu_Bala27-Dec-09 16:31 
GeneralRe: Assigned value becoam garbage value Pin
Nelek27-Dec-09 23:20
protectorNelek27-Dec-09 23:20 
QuestionHow to find out if a pe file has been packed? Pin
Joseph Marzbani25-Dec-09 18:50
Joseph Marzbani25-Dec-09 18:50 
AnswerRe: How to find out if a pe file has been packed? Pin
Adam Roderick J25-Dec-09 20:00
Adam Roderick J25-Dec-09 20:00 
QuestionFile browser control in MFC Pin
Member 439977125-Dec-09 18:47
Member 439977125-Dec-09 18:47 
AnswerRe: File browser control in MFC Pin
Joseph Marzbani25-Dec-09 18:54
Joseph Marzbani25-Dec-09 18:54 
AnswerRe: File browser control in MFC Pin
rp_suman27-Dec-09 0:12
rp_suman27-Dec-09 0:12 
Question[Message Deleted] Pin
Mattzimmerer25-Dec-09 16:43
Mattzimmerer25-Dec-09 16:43 
AnswerRe: Question regarding Kernal level drivers Pin
Mattzimmerer25-Dec-09 19:56
Mattzimmerer25-Dec-09 19:56 

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.