The other answers all contain significant dangers and omissions (e.g. just trying to cast without testing might be dangerous - unless you really really know that you can cast to the given type).
Read through this answer in full to get a feel and understanding/insight as to why things weren't happening as you'd wanted it to be.
Because you declared it specifcally to the "base" class,
try using the "var" keyword, and then newing up the "Derived" class.
class Demo
{
public static void Main()
{
var Obj = new Derived();
Obj.DerivedTestMethod();
}
}
If however you still want to explicitely declare it first to "Base"
Base Obj = new Derived();
then you can test whether the variable "Obj" is in fact of the class "Derived" by using the C# "is" keyword
if(Obj is Derived)
{
Obj = (Derived)obj; // here we cast it
}
else
{
// Other code, but now we know that the "Obj" variable isn't of type "Derived".
}
For more information on testing with the "is" keyword, see the MSDN documentation http://msdn.microsoft.com/en-us/library/scekt9xw.aspx or check this answer: https://stackoverflow.com/a/10416231/1155847