T
TwinkiE_HunteR-G
Hello all,
Ok, I am taking a C++ class at a local community college, and I'm
working on a small program for my own learning needs and I ran into a
problem.
The class I'm building includes a pointer to another object of the
same class, so that I can loop through the objects, using the objects
Next_Object() member function which returns the adress of the next
object in the list.
In my loop I am setting a pointer to the class to what Next_Object()
returns, and I need to check if that is NULL in order to exit the loop
(i.e tmp_object != NULL). Here is where my problem is. The compiler
says that I need to overload the != operator to do this, but if the
object is NULL, how would it call it's member function?
Any help would be appreciated.
- TwinkiE_HunteR-G strikes again!
: (e-mail address removed)
: HARD-WiRE Web Design
: http://www.hard-wire.net
Ok, I am taking a C++ class at a local community college, and I'm
working on a small program for my own learning needs and I ran into a
problem.
The class I'm building includes a pointer to another object of the
same class, so that I can loop through the objects, using the objects
Next_Object() member function which returns the adress of the next
object in the list.
In my loop I am setting a pointer to the class to what Next_Object()
returns, and I need to check if that is NULL in order to exit the loop
(i.e tmp_object != NULL). Here is where my problem is. The compiler
says that I need to overload the != operator to do this, but if the
object is NULL, how would it call it's member function?
Any help would be appreciated.
- TwinkiE_HunteR-G strikes again!
: (e-mail address removed)
: HARD-WiRE Web Design
: http://www.hard-wire.net