Problem of the day is type casting, maybe this will be more familiar to you:
System::Object ^o = 1;
int i = safe_cast<int>(o) + 1;
C# samples
public class BaseClass
{
protected int x = 0;
protected int y = 0;
public BaseClass(int valX, int valY)
{
x = valX;
y = valY;
}
public int Subtract()
{
return x - y;
}
}
public class InheritedClass : BaseClass
{
public InheritedClass(int valX, int valY) : base(valX, valY)
{
}
public int Add()
{
return x + y;
}
}
static void Main(string[] args)
{
// init inherited class as object
object o = new InheritedClass(2, 2);
// casting this as a base class I can't see the add method
((BaseClass)o).Subtract();
// cast it correctly then I can see the add method
((InheritedClass)o).Add();
}
C++ example (CLR)
public ref class BaseClass
{
protected:
int x;
int y;
public:
BaseClass(int valX, int valY)
{
x = valX;
y = valY;
}
int Subtract()
{
return x - y;
}
};
public ref class InheritedClass : BaseClass
{
public:
InheritedClass(int valX, int valY) : BaseClass(valX, valY)
{
}
int Add()
{
return x + y;
}
};
int main(array<System::String ^> ^args)
{
// init inherited class as object
System::Object ^o = gcnew InheritedClass(2, 2);
// casting this as a base class I can't see the add method
(safe_cast<BaseClass^>(o))->Subtract();
// cast it correctly then I can see the add method
(safe_cast<InheritedClass^>(o))->Add();
return 0;
}
Python example. This is a really bad example since the two examples above cannot be translated to python.
# lame example I know
class BaseClass:
def __init__(self, valX, valY):
self.x = valX
self.y = valY
def Subtract(self):
return self.x - self.y
class InheritedClass(BaseClass):
def __init__(self, base):
BaseClass.__init__(self, base.x, base.y)
def Add(self):
return self.x + self.y
base = BaseClass(3, 2)
print base.Subtract()
# print base.Add() # this throws out an error
inherited = InheritedClass(base)
print inherited.Add()
I tried to show you is that you can't preform certain operations on datatypes without proper casting.
Now back to the issue at hand. If you actually studied the return types of MissionLib.GetSubsystemByName you would notice that it returns a Subsystem type and that method GetMaxShields is valid for Shield types.
I actually already gave you an answer and posted it in my python example, I'm not sure how you could have missed it. You cast it to shield type and it should work.
App.ShieldClass_Cast(activeShieldGen)