B
Bob lazarchik
I am trying to derive a class from an existing class with parameters in the
constructor. Does anyone know why this is happening.
The Code
public class ClassA
{
public ClassA( int Param1 )
{
}
}
public class ClassB : ClassA
{
public ClassB( int Param1 )
{
}
}
I get a "No overload for method 'ClassA' takes '0' arguments" compiler
error. But if i change the class A constructor to as below the error
disappears. I know the first instance is creating the Object class which
takes 0 arguments then I am overriding this with the second constructor with
my parameter. Why do I need to do this or am I missing something else.
public class ClassA
{
public ClassA() : base()
{
}
public ClassA( int Param1 )
{
}
}
Thanks
Bob
constructor. Does anyone know why this is happening.
The Code
public class ClassA
{
public ClassA( int Param1 )
{
}
}
public class ClassB : ClassA
{
public ClassB( int Param1 )
{
}
}
I get a "No overload for method 'ClassA' takes '0' arguments" compiler
error. But if i change the class A constructor to as below the error
disappears. I know the first instance is creating the Object class which
takes 0 arguments then I am overriding this with the second constructor with
my parameter. Why do I need to do this or am I missing something else.
public class ClassA
{
public ClassA() : base()
{
}
public ClassA( int Param1 )
{
}
}
Thanks
Bob