|
-
June 18th, 2002, 09:30 PM
#1
Where are "this" pointers are assigned ?
As we all know, in C++, this means a pointer to
the object itself. But where and when is the pointer
created?
I have try the follwing cod:
class A{
A(){ cout<<"A::A() is called."; }
A(int a){ A(); cout<<"A:A(int a) is called"; };
~A(){ cout<<"A is destructing ...";}
}
main(){
A a;
return 0;
}
it shows that in the constructor A::A(int),
another tempory object of A is created.
Then the question is rasied:
Where and when is this be assigned,
at the beginning or at the end of the constructor?
Last edited by Lacura; June 18th, 2002 at 09:34 PM.
Every day is a new day.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|