Show/Hide Toolbars

XSharp

'type' does not contain a constructor that takes 'number' arguments.

 

This error occurs when you either directly or indirectly invoke the constructor of a class but the compiler cannot find any constructors with the same number of parameters. In the following example, the test class has no constructors that take any arguments. It therefore has only a default constructor that takes zero arguments. Because in the second line in which the error is generated, the derived class declares no constructors of its own, the compiler provides a default constructor. That constructor invokes a parameterless constructor in the base class. Because the base class has no such constructor, XS1729 is generated.

 

To correct this error

 

1.Adjust the number of parameters in the call to the constructor.

2.Modify the class to provide a constructor with the parameters you must call.

3.Provide a parameterless constructor in the base class.

Example

 

The following example generates XS1729:

 

 

// XS1729.prg