dynamic binding on parameters, how ??
- From: Victor Bogado <bogado@xxxxxxxxx>
- Date: 25 Apr 2007 07:20:06 -0700
I want to create a class hierarchy for geometric elements, each
element must know how to report if he intersect with other element.
The interface is the following :
abstract(?) class Element
{
// naive implementation.
public boolean interset(Element e)
}
class SquareElement extends Element
{
// how to intersect with a generic element
public bool intersect(Element &e)
// how to intersect with a square element
public bool intersect(SquareElement &e)
}
class CircleElement extends Element
{
// how to intersect with a generic element
public bool intersect(Element &e)
// how to intersect with a square element
public bool intersect(SquareElement &e)
// how to intersect with a circle element
public bool intersect(CircleElement &e)
};
The problem is that most OO languages I know (java, C++, D) don't do
dynamic binding based on the parameters of a call. Is there a pattern
for this behavior?
.
- Follow-Ups:
- Re: dynamic binding on parameters, how ??
- From: H. S. Lahman
- Re: dynamic binding on parameters, how ??
- Prev by Date: Re: Dependency Management (Was: Mixing P/R philosophy with OO)
- Next by Date: Re: Modeling events that occur in a game world
- Previous by thread: RUP activites across multiple roles?
- Next by thread: Re: dynamic binding on parameters, how ??
- Index(es):