Design: classes with same implementation but different method names
        Posted  
        
            by 
                Dror Helper
            
        on Programmers
        
        See other posts from Programmers
        
            or by Dror Helper
        
        
        
        Published on 2011-01-03T09:55:18Z
        Indexed on 
            2011/01/03
            10:00 UTC
        
        
        Read the original article
        Hit count: 392
        
I have multiple classes that have similar implementation for different named methods:
class MyClassX
{
   public int MyClassXIntMethod(){}
   public string MyClassXStringMethod(){}
}
class MyClassY
{
   public int MyClassYIntMethod(){}
   public string MyClassYStringMethod(){}
}
the methods inside the classes have similar implementation but because the method's names are different (due to 3rd party constraints) i cannot use inheritance.
I'm looking for an elegant solution that would be better than implementing the same functionality over and over again.
© Programmers or respective owner