[Tutor] OO approach

Karthik Gurumurthy karthikg@aztec.soft.net
Mon, 25 Feb 2002 14:39:25 +0530


> So I ended up going back and re-writing the mailURL class over and over
> again, everytime I added a sub-class. This defeats the purpose of using
> inheritance (I could simply write 10 different classes completely
> unrelated). So, what I want to ask you all is :

> - How do I make a minimalistic base class (not just in this situation,
>   but any task), and yet make it useful enough for the sub-classes.

I can relate to your problem very well!
Wasn't there anything at all that was common to all the approaches ( i mean
subclasses)?
Did you try refactoring the common parts? One simple way could be to move
all the common things up the base class.
Infact i guess, refactoring says that you start off writing such separate
classes and then move all the common parts
up the tree to the base class. I understand this is more like approaching
the problem from the other end though!

karthik