Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    cpp
  » Keyword: this
      by
 Page 1 of 6 
    Next >

(Login to remove green text ads)
Introduction
Preface

The this keyword is a special pointer often used in operator overloading and miscellaneous object oriented concepts. There is not much to tell about this keyword, which means that this tutorial will be a short one. Nevertheless, one needs a thorough understanding of what this keyword means to move on with the C++ language. This keyword is often used in operator overloading. But also in more exotic features like pointers to members.

Once again, the this keyword is not an intensive subject to study, so the code presented here will be very easy to understand. The previous version of this tutorial included an advanced code example using the Qt GUI library. I've removed that example because it is just to complex (at first sight) for less seasoned coders. There is no loss of information though. The Qt code was optional reading material anyway.

Prerequisites:
  • Very basic knowledge and handling of classes and it's instances (objects).
  • Basic understanding and handling of pointers.
  • Basic understanding and handling of functions. This includes passing parameters by value and by reference.

Every code snippet presented here is complete and ready to be copied into your console project. Only one *.cpp file is required.




 
 Page 1 of 6 
    Next >

Rate This Article
1 2 3 4 5 6 7 8 9 10





Copyright © 2000-2006, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting
Open Circle