Click here to Skip to main content
15,905,508 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionProblem with return value of private variable within class Pin
Michael Randolph25-Mar-09 18:04
Michael Randolph25-Mar-09 18:04 
AnswerRe: Problem with return value of private variable within class Pin
Md. Ali Naser Khan25-Mar-09 18:41
Md. Ali Naser Khan25-Mar-09 18:41 
GeneralRe: Problem with return value of private variable within class Pin
Michael Randolph25-Mar-09 18:57
Michael Randolph25-Mar-09 18:57 
GeneralRe: Problem with return value of private variable within class Pin
Md. Ali Naser Khan25-Mar-09 19:01
Md. Ali Naser Khan25-Mar-09 19:01 
GeneralRe: Problem with return value of private variable within class Pin
Michael Randolph25-Mar-09 20:40
Michael Randolph25-Mar-09 20:40 
GeneralRe: Problem with return value of private variable within class Pin
Cedric Moonen25-Mar-09 21:14
Cedric Moonen25-Mar-09 21:14 
GeneralRe: Problem with return value of private variable within class Pin
Niklas L26-Mar-09 1:25
Niklas L26-Mar-09 1:25 
AnswerRe: Problem with return value of private variable within class Pin
Stuart Dootson25-Mar-09 23:41
professionalStuart Dootson25-Mar-09 23:41 
Change the constructor to assign the constructor parameters to the members, either using initialiser syntax:

Point::Point(float f_x, float f_y, float f_z) : x(f_x), y(f_y), z(f_z)
{
   cout << "We're in the constructor with arguments " << (int)this /*unique identifier*/ << endl;
}<pre>

or explicit assignments

<pre>Point::Point(float f_x, float f_y, float f_z)
{
   x = f_x;
   y = f_y;
   z = f_z;
   cout << "We're in the constructor with arguments " << (int)this /*unique identifier*/ << endl;
}


As Cedric said - the compiler ain't magic - it doesn't look for similarities between parameter names and data member names and decide to assign parameters to data members automatically!

Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

GeneralRe: Problem with return value of private variable within class Pin
Michael Randolph26-Mar-09 19:14
Michael Randolph26-Mar-09 19:14 
GeneralRe: Problem with return value of private variable within class Pin
Stuart Dootson26-Mar-09 21:32
professionalStuart Dootson26-Mar-09 21:32 
GeneralRe: Problem with return value of private variable within class Pin
Michael Randolph27-Mar-09 2:40
Michael Randolph27-Mar-09 2:40 
QuestionHow can I remove vertical scrollbar from Microsoft web browser? Pin
Md. Ali Naser Khan25-Mar-09 17:54
Md. Ali Naser Khan25-Mar-09 17:54 
AnswerRe: How can I remove vertical scrollbar from Microsoft web browser? [modified] Pin
Yajnesh Narayan Behera26-Mar-09 3:35
Yajnesh Narayan Behera26-Mar-09 3:35 
Question"game" fast fingers Pin
Aljaz11125-Mar-09 8:18
Aljaz11125-Mar-09 8:18 
AnswerRe: "game" fast fingers Pin
Cedric Moonen25-Mar-09 8:21
Cedric Moonen25-Mar-09 8:21 
GeneralRe: "game" fast fingers Pin
Aljaz11125-Mar-09 8:26
Aljaz11125-Mar-09 8:26 
JokeRe: "game" fast fingers Pin
CPallini25-Mar-09 8:30
mveCPallini25-Mar-09 8:30 
GeneralRe: "game" fast fingers Pin
Aljaz11125-Mar-09 8:40
Aljaz11125-Mar-09 8:40 
GeneralRe: "game" fast fingers Pin
CPallini25-Mar-09 8:46
mveCPallini25-Mar-09 8:46 
GeneralRe: "game" fast fingers Pin
led mike25-Mar-09 9:35
led mike25-Mar-09 9:35 
GeneralRe: "game" fast fingers Pin
CPallini25-Mar-09 9:50
mveCPallini25-Mar-09 9:50 
GeneralRe: "game" fast fingers Pin
ThatsAlok25-Mar-09 17:44
ThatsAlok25-Mar-09 17:44 
GeneralRe: "game" fast fingers Pin
Aljaz11125-Mar-09 9:45
Aljaz11125-Mar-09 9:45 
GeneralRe: "game" fast fingers Pin
led mike25-Mar-09 10:02
led mike25-Mar-09 10:02 
GeneralRe: "game" fast fingers Pin
Cedric Moonen25-Mar-09 21:07
Cedric Moonen25-Mar-09 21:07 

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.