Click here to Skip to main content
15,919,479 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: excel to C++ Pin
mcsherry27-Jan-04 1:59
mcsherry27-Jan-04 1:59 
QuestionHow can i run my dialog in max. mode? Pin
P-Rex26-Jan-04 3:36
P-Rex26-Jan-04 3:36 
AnswerRe: How can i run my dialog in max. mode? Pin
David Crow26-Jan-04 4:33
David Crow26-Jan-04 4:33 
AnswerRe: How can i run my dialog in max. mode? Pin
P-Rex26-Jan-04 20:26
P-Rex26-Jan-04 20:26 
Generalbasic_istream::get calls setstate(failbit) if no elements was extracted Pin
Per G26-Jan-04 3:31
Per G26-Jan-04 3:31 
QuestionAmpersand usage in C++ ? Pin
LudaLuda26-Jan-04 3:27
LudaLuda26-Jan-04 3:27 
AnswerRe: Ampersand usage in C++ ? Pin
David Crow26-Jan-04 4:36
David Crow26-Jan-04 4:36 
AnswerRe: Ampersand usage in C++ ? Pin
Antti Keskinen26-Jan-04 6:09
Antti Keskinen26-Jan-04 6:09 
Putting the ampersand in front of a variable returns the address in memory where the variable is stored.

You cannot put the ampersand into the end of a variable. That is not legit. If you want the create a reference object, you put the ampersand after the variable's type declaration.

An example:
int a = 10; // A is a an int-variable
int& b = a; // B is a reference to A: altering B alters A and vice versa.
b = 20; // This would set A to '20'.

The code pieces you posted (const K&) declare constant references to objects. It means that you cannot alter the contents of the object through the reference. Note that references cannot be re-assigned after declaration: when you create the variable, you state where it refers to.

An example:
int a = 10;
const int& b = a;
b = 20; // This would cause a compiler error C2166

Constant references are often used in function calls to let the function have access to the variable without a permission to modify it. This means that in the above example, you can use variable B to read variable A's contents, but you can't modify it.

-Antti Keskinen

----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
AnswerRe: Ampersand usage in C++ ? Pin
John R. Shaw26-Jan-04 6:10
John R. Shaw26-Jan-04 6:10 
GeneralTemplates and DLLs from VC6 - VC.net Pin
Leifen26-Jan-04 3:19
Leifen26-Jan-04 3:19 
GeneralCustom Controls - Notifications Pin
peterchen26-Jan-04 1:59
peterchen26-Jan-04 1:59 
GeneralSubclass Pin
Dennis L26-Jan-04 0:45
Dennis L26-Jan-04 0:45 
GeneralRe: Subclass Pin
jhwurmbach26-Jan-04 1:42
jhwurmbach26-Jan-04 1:42 
GeneralVC++ .Net migration problem Pin
dene9997026-Jan-04 0:42
dene9997026-Jan-04 0:42 
GeneralRich edit custom line breaking Pin
Shah Shehpori26-Jan-04 0:34
sussShah Shehpori26-Jan-04 0:34 
GeneralRe: Rich edit custom line breaking Pin
Duncan Edwards Jones26-Jan-04 1:46
professionalDuncan Edwards Jones26-Jan-04 1:46 
GeneralRich edit Pin
edwinak26-Jan-04 0:18
edwinak26-Jan-04 0:18 
GeneralRe: Rich edit Pin
David Crow26-Jan-04 2:36
David Crow26-Jan-04 2:36 
General__try / __finally Pin
IceBerG7125-Jan-04 23:58
IceBerG7125-Jan-04 23:58 
GeneralRe: __try / __finally Pin
jhwurmbach26-Jan-04 1:52
jhwurmbach26-Jan-04 1:52 
GeneralRe: __try / __finally Pin
Tim Smith26-Jan-04 4:26
Tim Smith26-Jan-04 4:26 
GeneralRe: __try / __finally Pin
jhwurmbach26-Jan-04 5:03
jhwurmbach26-Jan-04 5:03 
GeneralRe: __try / __finally Pin
IceBerG7126-Jan-04 15:07
IceBerG7126-Jan-04 15:07 
GeneralRe: __try / __finally Pin
jhwurmbach26-Jan-04 21:11
jhwurmbach26-Jan-04 21:11 
Generalreading data from the modem Pin
farrrukh25-Jan-04 23:19
farrrukh25-Jan-04 23:19 

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.