My current code looks like this
this.actHandler = new MainAct(reqParams[2], new DatabaseHandler());
RegisterAct regAct = new RegisterAct();
return regAct.RegisterAction();
MainAct class
class MainAct
{
protected DatabaseHandler dbh;
protected MySqlConnection db;
protected MySqlDataReader reader;
protected MySqlCommand cmd;
protected string param;
public MainAct(string param, DatabaseHandler dbHandler)
{
this.param = param;
this.dbh = dbHandler;
this.db = this.dbh.ConnectDatabase();
}
}
RegisterAct class
class RegisterAct : MainAct
{
public string RegisterAction()
{
}
}
And Im getting the following error :
BloodServer.act.MainAct doesnt contain a constructor with 0 args
This is in the Parent class, which I thought I replaced.
Does the Parent constructor still get called? Is there a way to change this?
In your RegisterAct class, you need to add a constructor which calls the base constructor with the right parameters:
class RegisterAct : MainAct
{
public RegisterAct(string param, DatabaseHandler dbHandler) : base(param, dbHandler)
{
}
// Other methods/code here
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With