I have two classes named ROAD and PATH
public class ROAD
{
public string getData()
{
return "Marlton Road";
}
}
public class PATH
{
public string getData()
{
return "Tagore Path";
}
}
Also i have a function named FETCH() in my Static Void Main
FETCH() contains following code
public [B][I]returnType[/I][/B] FETCH(bool flag)
{
if(flag)
{
ROAD obj=new ROAD();
return obj;
}
else
{
PATH obj=new PATH();
return obj;
}
}
Now my question is what should be the return type of function FETCH().
Or is there any other way to implement this logic.