Click here to Skip to main content
15,887,267 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: creating limited objects Pin
David Crow11-Oct-09 16:43
David Crow11-Oct-09 16:43 
QuestionSmart card reader SLE4418_28 And SDI010 Pin
tanukochhar1811-Oct-09 2:39
tanukochhar1811-Oct-09 2:39 
QuestionReference question in C++ [modified] Pin
es196811-Oct-09 1:19
es196811-Oct-09 1:19 
AnswerRe: Reference question in C++ Pin
CPallini11-Oct-09 2:22
mveCPallini11-Oct-09 2:22 
GeneralRe: Reference question in C++ Pin
es196811-Oct-09 6:41
es196811-Oct-09 6:41 
GeneralRe: Reference question in C++ Pin
Rajesh R Subramanian11-Oct-09 7:29
professionalRajesh R Subramanian11-Oct-09 7:29 
GeneralRe: Reference question in C++ Pin
es196811-Oct-09 11:55
es196811-Oct-09 11:55 
GeneralRe: Reference question in C++ Pin
CPallini11-Oct-09 8:13
mveCPallini11-Oct-09 8:13 
Well, you know, roughly speaking, a reference is a sugar-added-pointer, so let's write your code again, this time using the real thing (BTW no need to say that Klingon developers don't use references, references are for sissies... Roll eyes | :rolleyes: )

#include <string>
using namespace std;
#include <stdio.h> 
void main()
{
	// case 0
	string str1 = "a";
	string str2 = "b";
	string * const pstr = &str1;//that's wath a reference really is

	printf("\ncase 0\n str1: %s", str1.c_str());
	printf("\n str2: %s", str2.c_str());
	printf("\n refstr: %s\n ", (*pstr).c_str());
	
	// case 1
	str1 = "aa";
	
	printf("\n case 1\n str1: %s", str1.c_str());
	printf("\n str2: %s", str2.c_str());
	printf("\n refstr: %s\n ", (*pstr).c_str());

	// case 2
	(*pstr) = str2;

	printf("\n case 2\n str1: %s", str1.c_str());
	printf("\n str2: %s", str2.c_str());
	printf("\n refstr: %s\n ", (*pstr).c_str());

	// case 3
	str2 = "bb";

	printf("\n case 3\n str1: %s", str1.c_str());
	printf("\n str2: %s", str2.c_str());
	printf("\n refstr: %s\n ", (*pstr).c_str());

}


If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.

This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke

[My articles]

GeneralRe: Reference question in C++ Pin
es196811-Oct-09 11:54
es196811-Oct-09 11:54 
QuestionCan an VC6 program be used to remote control another windows application ? Pin
Neil Urquhart10-Oct-09 21:02
Neil Urquhart10-Oct-09 21:02 
AnswerRe: Can an VC6 program be used to remote control another windows application ? Pin
Rick York10-Oct-09 21:51
mveRick York10-Oct-09 21:51 
Questionadd skin to my dialog Pin
santhosh-padamatinti10-Oct-09 19:44
santhosh-padamatinti10-Oct-09 19:44 
AnswerRe: add skin to my dialog Pin
cstic10-Oct-09 21:24
cstic10-Oct-09 21:24 
AnswerRe: add skin to my dialog Pin
Richard MacCutchan10-Oct-09 21:38
mveRichard MacCutchan10-Oct-09 21:38 
AnswerRe: add skin to my dialog Pin
wangningyu10-Oct-09 22:34
wangningyu10-Oct-09 22:34 
AnswerRe: add skin to my dialog Pin
Rajesh R Subramanian11-Oct-09 5:44
professionalRajesh R Subramanian11-Oct-09 5:44 
Questionthe skin of the point cloud from top view in C++ Pin
cstic10-Oct-09 11:22
cstic10-Oct-09 11:22 
AnswerRe: the skin of the point cloud from top view in C++ Pin
Richard MacCutchan10-Oct-09 21:36
mveRichard MacCutchan10-Oct-09 21:36 
QuestionHow to monitore idle time when minimized Pin
Daniel Kamisnki10-Oct-09 11:21
Daniel Kamisnki10-Oct-09 11:21 
AnswerRe: How to monitore idle time when minimized Pin
Randor 10-Oct-09 11:43
professional Randor 10-Oct-09 11:43 
GeneralRe: How to monitore idle time when minimized Pin
kilt13-Oct-09 2:30
kilt13-Oct-09 2:30 
GeneralRe: How to monitore idle time when minimized Pin
Randor 13-Oct-09 5:13
professional Randor 13-Oct-09 5:13 
Questionhow to caputure scrollview including unvisible area? Pin
rambojanggoon10-Oct-09 4:12
rambojanggoon10-Oct-09 4:12 
QuestionHow can i implement Smart card . Pin
tanukochhar1810-Oct-09 2:31
tanukochhar1810-Oct-09 2:31 
AnswerRe: How can i implement Smart card . Pin
Randor 10-Oct-09 11:39
professional Randor 10-Oct-09 11:39 

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.