Implementing Binary Operators in C++ - Tutorial
In principle, implementing binary operators such as
operator=
and
operator==
is fairly easy for simple types, but is amazingly
demanding for a class hierarchy of types. In this tutorial we will look
into the complexities and will discuss solutions. The core of the problem
stems from the fact, that objects in a class hierarchy have something in
common, namely their base class part. For this reason, it makes sense
to consider mixed-type operations where objects of different types from
the same class hierarchy are assigned to each other or compared to each
other. Does it make sense to allow mixed-type operations, and if
so, how can they be implemented correctly? |
|
PREREQUISITES
|
|
Level:
|
introductory / intermediate |
Duration:
|
1.5 hours |
Prerequisites:
|
Attendants should be familiar with C++. Expert knowledge
of C++ is not required. |
Presented at:
|
ACCU 2004
,
Oxford, UK, April 2004 |
If you are interested to hear more about this
and related topics you might want to check out the following seminar or
skim through some further reading:
|
Seminars
|
Slides
|
|