I have the following requirement,
Sorry I cant find a simple way to define my problem. It feels like a solution that spring framework provides. But I need to know how to acheive this from a Java/C# application.
It sounds like you want an abstract class implementing the common functionality, but still have two concrete classes for the distinct functionality. You may or may not still want to keep the interface as well. So the options are:
Interface
^
|
Abstract
class
^
/ \
Concrete Concrete
class 1 class 2
or just
Abstract
class
^
/ \
Concrete Concrete
class 1 class 2
Code which wants to use these classes just uses the interface or abstract class. How you configure which concrete class to use were will depend on your exact requirements - but presumably you'd already tackled that in the earlier version.
See more on this question at Stackoverflow