#include <bgobject.h>
Class diagram for BGType:
Public Members | |||
![]() | ![]() | virtual int | compare ( BGObject &obj ) = 0 |
![]() | ![]() | Compares two objects (derived from bgobject). More... | |
![]() | ![]() | bool | equals ( BGObject &obj ) |
![]() | ![]() | Returns true, if specified object is equal to own instance. More... |
We've defined compare method here, which will implicitely called from equals, because types often has more information than equals (i.e. numbers can be greater than...). With the help of this comparable behaviour, we can SORT all subclasses of BGType easily.
virtual int BGType::compare (BGObject & obj) [pure virtual]
|
Compares two objects (derived from bgobject).
This method is pure virtual and must be overwritten in subclasses.
obj | Object reference to compare with us |
Reimplemented in BGString.
bool BGType::equals (BGObject & obj) [inline, virtual]
|
Returns true, if specified object is equal to own instance.
First we compare class identifier. If both object has same class type, we dispatch to compare method, which should always be able to compare instances with same type.
obj | Object reference to compare with us |
Reimplemented from BGObject.