[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: QUrl in KDE 4
From:       John Firebaugh <jfirebaugh () kde ! org>
Date:       2005-05-20 3:08:16
Message-ID: EAAB998E-ADF6-4138-BC5B-768AC0F8BC21 () kde ! org
[Download RAW message or body]

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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic