I have a class that has grown quite large. It has come to pass that I would
like to expose a very small subset of this class' functionality as another
class(?). Here's the example:

I have class Foo with 10 methods lets say (Meth1 - Meth10)

class Foo {
        Meht1 {
        }

        Meth2 {
        }

        etc...
}

What I would like to do is something like the following:

1) Create a class that exposes only a portion of the functionality of class
Foo, Bar is a good name for this.

class Bar : inherits Foo (?) {

        Meth1 {
        }

        Meth7 {
        }
}

2) Give the "user" a choice of which class they would like to use depending
on the functionality they need.

class TestFooAndBar {
        Foo myFoo = new Foo();
        Bar myBar = new Bar();

        myFoo.Meth1 //works
        myFoo.Meth5 //works

        myBar.Meth1 //works just like the myFoo call above
        myBar.Meth5 //oops, the method doesn't exist

}

Is this doable? I don't really want to rewrite Foo into a new Bar, because
Bar would need about 90% of the internal Foo code to work properly and I
would like to avoid big changes to Foo as it is already implemented in a
large volume of code. What to do?

TIA
CJ


You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to