Re: Code generation
- From: "Jan Norden (Capable Objects]" <jan.norden@xxxxxxxxxx>
- Date: Thu, 5 Jun 2008 22:32:18 +0200
Nick Hodges (CodeGear) wrote:
Brad White wrote:
You would put the event handlers that you write
in the parent class that is autogenerated?
No, you'd put the code to link up the methods to the events in the
parent class -- if that is the way your component peristence worked.
I'm really saying in the general case, partial classes aren't
necessary, because an inheritence relationship can accomplish the same
thing.
Actually it can't. It will give the "B' does not inherit A'" sydrome.
Imagine two "real" classes, A and B, where B inherits from A.
As a (nowdays popular through NHibernate) trick you subclass them, at
codegen time or magically at runtime, into A?and B? to inject behaviour.
At this point, in terms of the actual runtime classes, B' does not
inherit A'.
This is usually not a problem, since B' does inhert A. And since the
user thinks he has a B, not a B', it mostly works out.
However, many legitimate uses including reflection and runtime checking
of types and subtypes give what can politely be referred to as
unexpected behaviour.
As an example, checking if two instances are are assignement compatible
will fail. You must know about the runtime subtyping, and check for
compatibility of the ancestors one step up.
--
Jan Nordén, ECO Architect
CapableObjects AB
email: <firstname>.<lastname without accent over e>@capableobjects.com
http://www.capableobjects.com
.
- Prev by Date: Re: Tiburon and PDA
- Next by Date: Re: Code generation
- Previous by thread: D2008 Unicode Question
- Next by thread: Re: Code generation
- Index(es):
Relevant Pages
|