Subject: CGAL users discussion list
List archive
- From:
- To:
- Subject: Kernel functors being hidden by same-name functors in derived classes
- Date: Tue, 7 Aug 2007 14:15:17 +0200
Dear CGAL developers and users,
As I understand it, some classes in CGAL derive from a (linear,circular)
kernel in order to add extra functionality, while still retaining the
functionality of the base kernel. For instance:
* the circular kernel derives from a linear kernel
* arrangement traits classes often derive from a linear or circular kernel
One would suppose that these derived classes still implement the model of the
class that they derive from. So it would be legal to do the following:
* define a linear kernel
* derive a circular kernel from it (extending the linear kernel)
* create an arrangement with CGAL::Arr_segment_traits_2<CircularKernel>
instead of the usual CGAL::Arr_segment_traits_2<LinearKernel>
This doesn't work as the circular kernel hides some functors from the linear
kernel. For instance, it defines CircularKernel::HasOn_2, which overrides
LinearKernel::HasOn_2. Both functors answer the same question for different
argument types. However, the CircularKernel::HasOn_2 cannot answer queries on
linear kernel objects. This yields errors when trying to use the circular
kernel where a linear kernel is expected (as in the example above).
Is it possible to extend functors of derived classes to implement the
functionality of the base class as well (e.g., by deriving from the functor
of the base class)? This way the concept of the base class would not be
destroyed as it is now.
Other examples: the functors Compare_y_at_x_2, Equal_2, Intersect_2,
Compare_y_at_x_2 in the Arr_segment_traits_2 class. These functors (and maybe
others that I've missed) also exist in the linear kernel that is being
derived from.
Kind regards,
Michiel De Wilde
- Kernel functors being hidden by same-name functors in derived classes, mdewilde . agilent, 08/07/2007
- Re: [cgal-discuss] Kernel functors being hidden by same-name functors in derived classes, Monique . Teillaud, 08/07/2007
Archive powered by MHonArc 2.6.16.