Thread: Can somebody please explain me the "this" pointer - the use & the matter?

  1. #1
    Registered User
    Join Date
    Sep 2009
    Location
    Europe / Latvia
    Posts
    5

    Can somebody please explain me the "this" pointer - the use & the matter?

    Hey there,
    I've been reading all over about the this pointer but I still don't get it, can somebody please actually explain it to me with some examples, of what it is, what's the purpose and everything else? If anyone have a free time for this.

    I would really appreciate it, thank you!

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    There is no this pointer in C.

    If you intend to ask about C++, then the this pointer points to the object you are currently a member of. (I.e., it's only valid when you are using a member function of a class, and then the this pointer refers to the object you used to call the function with. So doing "foo.func()" means that inside func, "this" would refer to foo, while doing "bar.func()" means that inside func, "this" would refer to bar.)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sorting the matrix question..
    By transgalactic2 in forum C Programming
    Replies: 47
    Last Post: 12-22-2008, 03:17 PM
  2. Ban pointers or references on classes?
    By Elysia in forum C++ Programming
    Replies: 89
    Last Post: 10-30-2007, 03:20 AM
  3. scope of a pointer?
    By Syneris in forum C++ Programming
    Replies: 6
    Last Post: 12-29-2005, 09:40 PM
  4. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 09:32 AM
  5. the "this" pointer
    By Swaine777 in forum C++ Programming
    Replies: 8
    Last Post: 05-22-2003, 12:12 PM