CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Threaded View

  1. #1
    Join Date
    May 2002
    Location
    China,P.R.C
    Posts
    24

    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
  •  





Click Here to Expand Forum to Full Width

Featured