Hi,
I am very interested in using polymorphism in UiPath and need to find out how to do this.
Real example:
As input to my process, I have the results of a query to a db. Each row received represents a product.
In Visual Studio, I have an interface class, IProduct, which is implemented by all types of products available.
I have also a factory class which takes as input the current row, and returns the corresponding product in a reference to the interface class:
public static IProduct Create(DataRowCollection row)
It works fine in UiPath Studio when I call on the factory, using a Assign Activity:
IProduct iProduct = Factory.Create(row)
Now I want to call the method GetValue() on the variable iProduct and through dynamic binding delegate the call the corresponding overridden methods in the derived product classes. This should work easily if I only have simple logic in this method, but what GetValue() should do is to go to the specific home pages of the product in question and do data scraping etc. So the functionality encapsulated by the GetValue() methods in the derived product classes is typical UiPath business.
How can I achieve this ?
For example, it would be really nice if I could create a library in UiPath Studio for a product and in there define GetValue() method which overrides the one in the interface and then call on this library/method in the main workflow.
Can I define classes/interfaces/abstract classes/inheritance hierarchies somewhere in UiPath Studio and reference them in my workflows, or do I have to do that in for example Visual Studio and publish a package which I then import in UiPath Studio to be able to reference the classes ?