Click here to Skip to main content
15,913,453 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: runtime vector creating Pin
CPallini25-May-07 10:20
mveCPallini25-May-07 10:20 
AnswerRe: runtime vector creating Pin
John R. Shaw25-May-07 14:34
John R. Shaw25-May-07 14:34 
QuestionCToolTipCtrl Problem Pin
somasundaram_be25-May-07 6:32
somasundaram_be25-May-07 6:32 
QuestionRe: CToolTipCtrl Problem Pin
David Crow25-May-07 7:29
David Crow25-May-07 7:29 
AnswerRe: CToolTipCtrl Problem Pin
somasundaram_be25-May-07 18:44
somasundaram_be25-May-07 18:44 
QuestionRe: CToolTipCtrl Problem Pin
David Crow27-May-07 16:52
David Crow27-May-07 16:52 
AnswerRe: CToolTipCtrl Problem Pin
S Douglas26-May-07 21:58
professionalS Douglas26-May-07 21:58 
QuestionPrivate member. Pin
shiraztk25-May-07 5:20
shiraztk25-May-07 5:20 
Hi
I have one silly question.

I have a class

Shape
{
private:
int x, y, z;
public:

void Get(Shape& s)
{
x = s.x;
y = s.y;
z = s.z;
}
};

This code compiles fine. But how? How can I access the private memebers s.x, s.y and s.z inside Get() even if it is member function of Shape. Both this and s are two different objects how can they access private members inside the class definition? if this happens then,

int main()
{
Shape s, s1;
s.x = s1.x;
}

this should also work, right?

I am wondering why things are designed like this?

Regards


The Best Religion is Science.
Once you understand it, you will know God.

AnswerRe: Private member. Pin
Mark Salsbery25-May-07 5:25
Mark Salsbery25-May-07 5:25 
GeneralRe: Private member. Pin
shiraztk25-May-07 5:34
shiraztk25-May-07 5:34 
GeneralRe: Private member. Pin
Mark Salsbery25-May-07 5:42
Mark Salsbery25-May-07 5:42 
AnswerRe: Private member. Pin
CPallini25-May-07 5:33
mveCPallini25-May-07 5:33 
AnswerRe: Private member. Pin
Manoj Kumar Rai25-May-07 5:46
professionalManoj Kumar Rai25-May-07 5:46 
AnswerRe: Private member. Pin
Expert Coming25-May-07 8:31
Expert Coming25-May-07 8:31 
GeneralRe: Private member. Pin
David Crow25-May-07 10:04
David Crow25-May-07 10:04 
AnswerRe: Private member. Pin
John R. Shaw25-May-07 14:51
John R. Shaw25-May-07 14:51 
QuestionMangling of CString in fstream Pin
ldsdbomber25-May-07 4:18
ldsdbomber25-May-07 4:18 
AnswerRe: Mangling of CString in fstream Pin
David Crow25-May-07 4:43
David Crow25-May-07 4:43 
GeneralRe: Mangling of CString in fstream Pin
Stephen Hewitt27-May-07 15:15
Stephen Hewitt27-May-07 15:15 
QuestionRe: Mangling of CString in fstream Pin
David Crow27-May-07 16:49
David Crow27-May-07 16:49 
AnswerRe: Mangling of CString in fstream Pin
Stephen Hewitt27-May-07 16:54
Stephen Hewitt27-May-07 16:54 
GeneralRe: Mangling of CString in fstream Pin
David Crow27-May-07 16:56
David Crow27-May-07 16:56 
AnswerRe: Mangling of CString in fstream Pin
Stephen Hewitt27-May-07 15:13
Stephen Hewitt27-May-07 15:13 
Questionoperator overloading Pin
Kiran Pinjala25-May-07 3:42
Kiran Pinjala25-May-07 3:42 
AnswerRe: operator overloading Pin
David Crow25-May-07 3:45
David Crow25-May-07 3:45 

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.