I have 3 classes :-
public Class Example1
{
  public void Method1()
  {
  }
  public void Method2()
  {
  }
}
public Class Example2
{
  public void Method3()
  {
  }
  public void Method4()
  {
  }
}
public Class CompletelyDifferentClass
{
  public void DifferentMethod(Example1/Example2 obj)
  {
      obj.Method1(); //if object is passed for Example1
      obj.Method3(); //if object is passed for Example2
  }
}
If we see CompletelyDifferentClass and public DifferentMethod(Example1/Example2 obj)
I want DifferentMethod to get parameter as any time I can send Example1 object or Example2 object. If Example2 object is sent , it should enable methods for Example2 like obj.Method3();
It is not fixed that which class's object I am going to send as a parameter to that method.
How can I write a code for DifferentMethod
 
     
    