QUrl in KDE 4
John Firebaugh
jfirebaugh at kde.org
Fri May 20 04:08:16 BST 2005
On May 19, 2005, at 7:02 PM, Frans Englich wrote:
> As Thiago, I disagree, because with that approach you will find the
> problem in
> any object oriented design; where something is a subset,
> constrainment, of
> something wider -- what class hierarchies usually are about,
> AFAICT. A square
> is a subset of the recangle's value space, so to speak.
[snip]
> Hence, I don't see representation problem Thiago sees. Perhaps an
> elaboration
> can be provided?
On the contrary, class hierarchies are ill suited to this type of
subset relationship:
class Rectangle
{
Rectangle( int width, int height );
void SetDimensions( int width, int height );
// ...
};
class Square : public Rectangle
{
Square( int widthAndHeight );
// ...
};
Square s( 5 );
s.SetDimensions( 10, 5 );
// eek, s is no longer square!
Inheriting the other way around doesn't work either.
See also http://c2.com/cgi/wiki?CircleAndEllipseProblem
The URL/URI relationship is very similar.
John
More information about the kde-core-devel
mailing list