N
Noodle
Hi Guys, not sure if anyone can help me on this one but......
I have a class that I overload the equality operator (=). I also have
a class that inherits from this first class which has extra attributes
that i need to check to see if they are equal for the previous
overload to work correctly. No my question is how do I do this? The
obvious answer is to overload the overloaded operator and then copy
the comparison routine from the inherited object and copy it to the
new routine in the derived class, then add any extra comparisons.
although this will work for me, it adds the posibility that the base
class will be updated and derived classes that inherit from it will
not have a working comparison check as the new code added to the
original class will need to be copied to the new one.
Now I know that I can use mybase to access the base object of an
inherited object but as the overloaded function takes in two arguments
of type (derived class) how can I access the base class to do the
comparison.
Thanks in advance,
Dean.
I have a class that I overload the equality operator (=). I also have
a class that inherits from this first class which has extra attributes
that i need to check to see if they are equal for the previous
overload to work correctly. No my question is how do I do this? The
obvious answer is to overload the overloaded operator and then copy
the comparison routine from the inherited object and copy it to the
new routine in the derived class, then add any extra comparisons.
although this will work for me, it adds the posibility that the base
class will be updated and derived classes that inherit from it will
not have a working comparison check as the new code added to the
original class will need to be copied to the new one.
Now I know that I can use mybase to access the base object of an
inherited object but as the overloaded function takes in two arguments
of type (derived class) how can I access the base class to do the
comparison.
Thanks in advance,
Dean.