Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > Help using keyw...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 44235 of 47561
Post > Topic >>

Help using keyword this

by pauldepstein@[EMAIL PROTECTED] Mar 31, 2008 at 04:37 AM

Here is the problem piece of my code:

Please note that SafePointerToCats is a safe pointer (boost library)
to the Cats class, DerivedFromCats is a class that is derived from
Cats and SafePointerToDerivedFromCats is a safe pointer to
DerivedFromCats.
PointerToSomeClass is a safe pointer to SomeClass

class SomeClass
{
      private: SafePointerToCats  CatPointer;

      public: SomeClass() {}
              void setCatPointer (SafePointerToCats cat){CatPointer =
cat;}

};

//Then in some other file..

void DerivedFromCats::SomeFunction( someparameter& something,
anotherparameter& anotherthing)

{
   PointerToSomeClass PointersAreCool ( new SomeClass());
	PointersAreCool -> setCatPointer (this);
}

My hope was that this code would result in in CatPointer pointing at
the derived class.  Instead it gave a compile error.

What is wrong here?

Thanks for your help,

Paul Epstein
 




 2 Posts in Topic:
Help using keyword this
pauldepstein@[EMAIL PROTE  2008-03-31 04:37:49 
Re: Help using keyword this
"Victor Bazarov"  2008-03-31 07:57:27 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Sep 7 3:51:11 CDT 2008.