[thelist] more OOD fun

Scott Dexter dexilalolai at yahoo.com
Mon Oct 11 13:44:38 CDT 2004


I'm building up a small site for a buddy, and using the opportunity
to get into asp.net (C#). Anyhoo.

I've confused myself a little and I'm curious what a best path would
be to take:

I have a Person class, and two (possibly three) subclasses. I have an
IPerson interface defined, and the Person class implementing it. I
have a different class using IPerson objects, but there are a couple
instances where I want to access properties in one of the Person
subclasses, outside the interface. My question is mutli-fold:

Where is the (better?) place to implement the interface? On the
subclasses?

Do I include everything I access into the interface, despite the fact
there may be items in there not used depending on the subclass?

The specifics: Person is subclassed into Guest and Guide classes. The
Guest class extends Person by adding payment information and
comments, items not in the Guide class. Now in the application, if I
don't have teh payment information in the IPerson interface, I can't
get to it, unless I declare the object as a Guest, which avoids the
interface, which is not the best thing to do ... right?

Thanks, I'm sorry if I'm not being clear...

sgd
(Those who have been around a while may be surprised to find out this
is the first time I've really done any OOD to this extent. Go figure)


More information about the thelist mailing list