Re: why no struct inheritance?
- From: Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
- Date: Sat, 12 May 2007 15:46:59 +0100
Paul Werkowitz <newsgroups@xxxxxxxxxxxxxxxx> wrote:
<snip>
Note that we have value types, not reference types. That means: it all
depends on the definition of the assignment operator. Since we cannot
overload the assignment operator, your statement is illegal for any user
defined structs Point and ExtendedPoint.
No argument against derivation of structs.
So there'd be no polymorphism possible... sounds like a good argument
against derivation of structs to me. I wouldn't be able to pass an
ExtendedPoint to a method requiring a Point, contrary to all normal
expectations. To not have a conversion available from a derived type to
the base type seems very odd to me.
--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
.
- Follow-Ups:
- Re: why no struct inheritance?
- From: Paul Werkowitz
- Re: why no struct inheritance?
- References:
- why no struct inheritance?
- From: not_a_commie
- Re: why no struct inheritance?
- From: Jon Skeet [C# MVP]
- Re: why no struct inheritance?
- From: Paul Werkowitz
- why no struct inheritance?
- Prev by Date: Re: simple casting problem (with small code example)
- Next by Date: Re: simple casting problem (with small code example)
- Previous by thread: Re: why no struct inheritance?
- Next by thread: Re: why no struct inheritance?
- Index(es):
Relevant Pages
|