Geekpedia Tutorials Home

Building a C# Chat Client and Server

Building a C# Chat Client and ServerA step by step tutorial teaching you how to create your own chat client and chat server easily in C#, for local networks or the Internet.

in C# Programming Tutorials

Getting Hard Drive Information

Getting Hard Drive InformationA C# tutorial showing you how to make use of WMI to extract information on disk drives, such as model, capacity, sectors and serial number.

in C# Programming Tutorials

UPS Shipping Calculator

UPS Shipping CalculatorThis tutorial will teach you how to calculate the shipping cost based on the weight, height, length and depth of the box, the distance and the UPS service type.

in PHP Programming Tutorials

Create Your Own Rich Text Editor

Create Your Own Rich Text EditorCreating a Rich Text Editor using JavaScript is easier to do than you might think, thanks to the support of modern browsers; this tutorial will walk you through it.

in JavaScript Programming Tutorials
Search
Tutorials
Programming Tutorials
IT Jobs
From CareerBuilder

Smart Pointers - Part 1

Programming tutorial for understanding "Smart Pointers".

On Wednesday, May 19th 2004 at 07:04 AM
By Hamed Zaghaghi (View Profile)
***--   (Rated 2.6 with 16 votes)
Contextual Ads
More C++ Resources
Advertisement

Smart Pointers :
"In C++, an object that implements the functionality of a pointer and additionaly performs some action whenever an object is accessed through it. Smart pointers are implemented by overloading the pointer-derefrence(->) operator".

above is about smart pointers,
but
how to overload the -> operator?
how to implement a "smart pointers"?
and are "smart pointers" useful?
are the FAQ of "smart pointers".
in this part I show that how to overload the -> operator by this example:


  class sp1
  {
       public:
           int data;
           sp1* operator ->() { return this;};
  };

  int main()
  {
       sp1 t;
       cin >> t.data;
       cout << t->data;
  }

see that (->) operator work the same as (.) operator.
NOTE:
(.) oprator can't be overloaded.
GoodLuck.

Digg Digg It!     Del.icio.us Del.icio.us     Reddit Reddit     StumbleUpon StumbleIt     Newsvine Newsvine     Furl Furl     BlinkList BlinkList

Rate Rate this tutorial
Comment Current Comments
by Sina Marandinan on Friday, May 21st 2004 at 09:38 PM

Nice, It is an intresting technic, tanx.

by Sina Marandinan on Friday, May 21st 2004 at 09:40 PM

Nice, It is an intresting technic, tanx.

by Shiva on Saturday, October 30th 2004 at 04:09 AM

Small and Superb tip to freshers who are new to C++ and guys who want to familiar with C++ Pointers.

by whatever on Friday, January 11th 2008 at 10:46 PM

You dont explain the part about the pointer being smart, how is that part used and how would one benefit from it in a program. kind of brief description.

still good effort

by Nishikant on Thursday, March 25th 2010 at 02:04 AM

Not useful, pass other useful example


Comment Comment on this tutorial
Name: Email:
Message:
Comment Related Tutorials
There are no related tutorials.

Comment Related Source Code
There is no related source code.

Jobs C++ Job Search
My skills include:
Enter a City:

Select a State:


Advanced Search >>
Sponsors
Discover Geekpedia

Other Resources