Issue with abstract classes

This is a discussion on Issue with abstract classes within the C# Programming forums, part of the General Programming Boards category; I am using a library of code which has some classes defined like such:
Code:
public abstract class A
{
...

Issue with abstract classes

So we have a class A and a class B which inherits from A. Class A is also abstract.

Now, we then have some function somewhere in the code which declares an instance of class B, does some operations on that object, and then returns it to the caller. It, however, returns it as if it were an instance of class A. It is something like this:

Code:

public A ReturnInstanceOfA()
{
B myobj = new B();
return B;
}

Now, as a client to this library, I would like to call this function which instantiates an object of class B and returns it to me, and I want to see it as being a B and not an A. So I do this: