hop of those help? You basically can't (short of using tricks with reflection). That's how inheritance in C# works. What you could do instead of overriding Run is to shadow it:
public class Parent
public void Run() => Console.WriteLine("Parent");
public class Child : Parent
public new void Run() => Console.WriteLine("Child");
var child = new Child();
child.Run(); // prints "Child"
((Parent)child).Run(); // prints "Parent"
help you fix your problem unless the view are inflating is actually an ActivityMonitorItemView then you will get the exception. You must in your xml file, give the full name of your class. So instead of LinearLayout it would be like
I hope this helps . I have a parent class and a child class which has a function specific to it that the parent class does not have. I create a vector of type Parent and add an object of type Child to it. I know for sure that said item is a child, so I attempt to use a static_cast to create a pointer to it in order to use its child specific function, but it refuses to convert giving the error described in the code below. , Why is this happening
//I know for a fact that the item is a child
items.push_back(Child()); // <<<< You are copying and slicing here
//Static cast to use child specific function doesn't work
Child* childPtr = static_cast<Child*>(items);
childPtr->childSpecificFunction(); // <<<<< undefined behavior
//Gives intellisence error: no suitable conversion from "Parent" to "Child *" exists
items.push_back(std::make_unique<Child>()); // <<< working with pointers,
// no slicing.
Child* childPtr = static_cast<Child*>(items.get());
InvalidCastException when casting from child to parent