Click here to Skip to main content
16,005,552 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionObtain a value from a variable in a class method. Pin
e40s7-Nov-07 11:47
e40s7-Nov-07 11:47 
QuestionRe: Obtain a value from a variable in a class method. Pin
David Crow7-Nov-07 16:56
David Crow7-Nov-07 16:56 
AnswerRe: Obtain a value from a variable in a class method. Pin
e40s8-Nov-07 3:21
e40s8-Nov-07 3:21 
GeneralRe: Obtain a value from a variable in a class method. Pin
toxcct8-Nov-07 3:28
toxcct8-Nov-07 3:28 
JokeRe: Obtain a value from a variable in a class method. Pin
David Crow8-Nov-07 3:30
David Crow8-Nov-07 3:30 
GeneralRe: Obtain a value from a variable in a class method. Pin
toxcct8-Nov-07 3:33
toxcct8-Nov-07 3:33 
GeneralRe: Obtain a value from a variable in a class method. [modified] Pin
e40s8-Nov-07 3:52
e40s8-Nov-07 3:52 
GeneralRe: Obtain a value from a variable in a class method. Pin
toxcct8-Nov-07 5:12
toxcct8-Nov-07 5:12 
hum, well, i will consider this not to be a personal attack against me, but just a lack of knowledge and maturity about C++.

so, to puch you on the right way, you should start here[^] (we should all Poke tongue | ;-P );
then, here is what i can say to you :

e40s wrote:
>> Not possible since it is local to the OnDataReady() method.
Extremely informative! Thanks!!


well, if you don't know what local means, it's going to be hard for us to explain more, and hard for you to understand more. it part of the basics of many simple programming languages, which basics C and C++ are based upon.
a variable is local to the scope it's been defined within. if you define a variable inside a function, you will be able to access it from within the function, not from outside (outside can mean "from the caller").
if you don't understand this concept, you should first take a book about the programming language of your choice and read the control structures paragraph.

e40s wrote:
>>Can you make it a class member variable instead?


David's reflexion makes perfect sense to me.

e40s wrote:
David, if you or others can explain to me the proper way to do this, I would be grateful


as i said, his sentence made sense, so the problem is not that we don't explain the proper way, but that you don't understand it...

e40s wrote:
Will it mostly be defined through the header file of this source module?


not quite. if it's a member of the class, it's defined inside the class, no matter which file the class is defined on.

e40s wrote:
Also are class member variables ordinarily prefixed with "m_"?


that's it, but that's just naming conventions, nothing/noone obliges you to stick to such variable namings...

any more questions ?


GeneralRe: Obtain a value from a variable in a class method. Pin
e40s8-Nov-07 5:36
e40s8-Nov-07 5:36 
GeneralRe: Obtain a value from a variable in a class method. Pin
toxcct8-Nov-07 5:54
toxcct8-Nov-07 5:54 
GeneralRe: Obtain a value from a variable in a class method. [modified] Pin
e40s8-Nov-07 5:58
e40s8-Nov-07 5:58 
GeneralRe: Obtain a value from a variable in a class method. Pin
toxcct8-Nov-07 6:23
toxcct8-Nov-07 6:23 
GeneralRe: Obtain a value from a variable in a class method. Pin
e40s8-Nov-07 6:37
e40s8-Nov-07 6:37 
GeneralRe: Obtain a value from a variable in a class method. Pin
toxcct8-Nov-07 6:45
toxcct8-Nov-07 6:45 
GeneralRe: Obtain a value from a variable in a class method. Pin
e40s8-Nov-07 7:00
e40s8-Nov-07 7:00 
GeneralRe: Obtain a value from a variable in a class method. Pin
BadKarma8-Nov-07 5:13
BadKarma8-Nov-07 5:13 
GeneralRe: Obtain a value from a variable in a class method. Pin
e40s8-Nov-07 5:26
e40s8-Nov-07 5:26 
GeneralRe: Obtain a value from a variable in a class method. Pin
David Crow8-Nov-07 8:43
David Crow8-Nov-07 8:43 
GeneralRe: Obtain a value from a variable in a class method. [modified] Pin
e40s8-Nov-07 9:05
e40s8-Nov-07 9:05 
Questionc++ path management functions Pin
Capitanevs7-Nov-07 10:15
Capitanevs7-Nov-07 10:15 
AnswerRe: c++ path management functions Pin
Mark Salsbery7-Nov-07 10:44
Mark Salsbery7-Nov-07 10:44 
GeneralRe: c++ path management functions Pin
Peter Weyzen7-Nov-07 15:33
Peter Weyzen7-Nov-07 15:33 
GeneralRe: c++ path management functions Pin
Roger Broomfield7-Nov-07 15:52
Roger Broomfield7-Nov-07 15:52 
QuestionHow can i open some Form application as child of other Form application ? Pin
Yanshof7-Nov-07 10:05
Yanshof7-Nov-07 10:05 
AnswerRe: How can i open some Form application as child of other Form application ? Pin
Hamid_RT7-Nov-07 17:36
Hamid_RT7-Nov-07 17:36 

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.