I have an object that implements an interface and inherits from another class. However for a function, I can only pass in an interface of the item. Is it possible to get a variable from the parent object or null if they are not there?
public class ProductStamp
{
public int qty;
}
public class TrolleyItem : ProductStamp, ITrolleyItem
{
}
private void foo(ITrolleyItem trolleyItem)
{
trolleyItem.qty;
}
Sorry for the confusing situation. I just want to know if this is possible and if so how I can best go about it.
Note: I have simplified the situation but each of these classes are in very separate places with other attachments relying on them. Due to how it is structured, I cannot simply pass in foo(TrolleyItem trolleyItem)
thank you in advance