On 30 January 2013 20:08, Michael S. Tsirkin <m...@redhat.com> wrote:
> Anthony wrote:
>> Nope.  You can use composition:
>>
>> QXLDevice is-a VGACommonState
>>
>> QXLPCI is-a PCIDevice
>>        has-a QXLDevice
>
> But why like this?
> The distinction is artificial, isn't it?

I think it's the wrong way round. QXLPCI should has-a PCI interface
(the physical card possesses an edge connector which fits a PCI
socket; it is not the case that the physical card is a kind of
edge connector). Having PCI card models inherit from PCIDevice
is just a convenient (but misleading) shortcut, and that is what
we should drop if it turns out that we should be inheriting
from some other class.

Or you could make them both has-a; I don't know enough about
QXLDevice to know if it should be is-a or has-a.

-- PMM

Reply via email to