T
ToChina
Hi, I have the following code:
class A
{
}
class B : A
{
}
and a method of another class which is like so:
void MethodName(ref A blah)
{
blah.Whatever = 0;
}
I'm calling the method with the subclass B:
B subclass = new B();
MethodName(ref subclass);
However, I'm getting the compiler error:
The best overloaded method match for 'MethodName(ref A)' has some invalid
arguments
error CS1503: Argument '1': cannot convert from 'ref B' to 'ref A'
What am I missing?
class A
{
}
class B : A
{
}
and a method of another class which is like so:
void MethodName(ref A blah)
{
blah.Whatever = 0;
}
I'm calling the method with the subclass B:
B subclass = new B();
MethodName(ref subclass);
However, I'm getting the compiler error:
The best overloaded method match for 'MethodName(ref A)' has some invalid
arguments
error CS1503: Argument '1': cannot convert from 'ref B' to 'ref A'
What am I missing?
