Click here to Skip to main content
16,011,947 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionEnabling and Diabling a Control Pin
celllllllll5-Jan-07 8:07
celllllllll5-Jan-07 8:07 
AnswerRe: Enabling and Diabling a Control Pin
Eytukan5-Jan-07 8:19
Eytukan5-Jan-07 8:19 
AnswerRe: Enabling and Diabling a Control Pin
jeron15-Jan-07 8:19
jeron15-Jan-07 8:19 
GeneralRe: Enabling and Diabling a Control Pin
celllllllll5-Jan-07 8:28
celllllllll5-Jan-07 8:28 
GeneralRe: Enabling and Diabling a Control Pin
Eytukan5-Jan-07 8:36
Eytukan5-Jan-07 8:36 
Questionhiding variables Pin
swjam5-Jan-07 7:37
swjam5-Jan-07 7:37 
AnswerRe: hiding variables Pin
Eytukan5-Jan-07 7:52
Eytukan5-Jan-07 7:52 
GeneralRe: hiding variables Pin
Chris Losinger5-Jan-07 11:10
professionalChris Losinger5-Jan-07 11:10 
VuNic wrote:
This would give a redefinition error since you have a already in the function parameter.


a small modification, and it will compile fine:
void memFx(int a)
{
	{
	   int a;
	   a = 25;
		
	   cout << "a: " << a << endl ;
	}
}


that's variable hiding. the 'a' inside the brackets hides the 'a' from the containing scope, and so the function always outputs 25.

inner scope hides outer scope.

i'm not sure what all the rules are, though.




GeneralRe: hiding variables Pin
Eytukan5-Jan-07 16:45
Eytukan5-Jan-07 16:45 
GeneralRe: hiding variables Pin
S Douglas7-Jan-07 0:24
professionalS Douglas7-Jan-07 0:24 
GeneralRe: hiding variables Pin
Chris Losinger7-Jan-07 4:35
professionalChris Losinger7-Jan-07 4:35 
GeneralRe: hiding variables Pin
S Douglas7-Jan-07 14:15
professionalS Douglas7-Jan-07 14:15 
QuestionHow to minimize exposed resources Pin
Joe Smith IX5-Jan-07 6:40
Joe Smith IX5-Jan-07 6:40 
AnswerRe: How to minimize exposed resources Pin
Dominik Reichl5-Jan-07 6:59
Dominik Reichl5-Jan-07 6:59 
AnswerRe: How to minimize exposed resources Pin
James R. Twine5-Jan-07 7:24
James R. Twine5-Jan-07 7:24 
Questiondebug_hex command error Pin
ikbahrian5-Jan-07 5:08
ikbahrian5-Jan-07 5:08 
QuestionRe: debug_hex command error Pin
David Crow5-Jan-07 6:07
David Crow5-Jan-07 6:07 
AnswerRe: debug_hex command error Pin
ikbahrian6-Jan-07 0:56
ikbahrian6-Jan-07 0:56 
QuestionHow to get a message when change occurs in clipboard? Pin
Max++5-Jan-07 4:57
Max++5-Jan-07 4:57 
AnswerRe: How to get a message when change occurs in clipboard? Pin
James R. Twine5-Jan-07 5:05
James R. Twine5-Jan-07 5:05 
AnswerRe: How to get a message when change occurs in clipboard? Pin
PJ Arends5-Jan-07 7:27
professionalPJ Arends5-Jan-07 7:27 
AnswerRe: How to get a message when change occurs in clipboard? Pin
Michael Dunn5-Jan-07 8:06
sitebuilderMichael Dunn5-Jan-07 8:06 
Questioncompiling error Pin
Tjie Pouw5-Jan-07 4:21
Tjie Pouw5-Jan-07 4:21 
AnswerRe: compiling error Pin
led mike5-Jan-07 4:53
led mike5-Jan-07 4:53 
QuestionHow to acces instance of a class or a view at runtime? Pin
Arris745-Jan-07 4:01
Arris745-Jan-07 4:01 

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.