interface / inheritance?

G

Guest

hi,

I have a scenario where I would like to create a windows application and
using a class to return a message so that it can be displayed on the windows
application when a button is clicked.

After that is done, I would compile and package the windows application and
class for customer.

WIthout have to provide the source code of the windows application and class
file, how can the customer easily create a new class that implement the
compiled class to add more features such as displaying another message when
the button on the windows application is clicked? The previous message that
implemented in the compiled class should also be displayed and should not be
overrided.

How would this be implemented? Appreciate if this can be explained in simple
code.

THanks,
C# Newbie
 
N

Nick Malik

Take a look at the Decorator pattern or the Chain of Responsibility pattern
in the Gang of Four patterns.

http://www.dofactory.com/Patterns/Patterns.aspx

You will also need to look at one of the creational patterns so that you can
set up the structure correctly. (Perhaps Builder).

I suppose, if you are not going to provide the source code for the calling
side, you will want to provide the capability for the user to provide the
name of a class to call in the config file. Then your code can simply call
any classes that the user defines that meet your interface criteria and
which interact in the chosen pattern in the way you've defined.

See Assembly.Load
http://msdn.microsoft.com/library/d...lrfSystemReflectionAssemblyClassLoadTopic.asp

Hope this helps,

--- Nick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top