Having the same issue i was last week only with inheiriting from the parent class:
public ExtendedTime(int Hour, int Minute, String TimeZone) :base(hour, minute)
{
timeZone = TimeZone;
}//end of ExtendedTime
:base(hour,minute)
is where i have this error.
Says the same problem for both hour and minute.
Now usually I would say that i'm missing something far as a property but i tried that and it didn't do any good sadly.
in the parent class hour and minute are declared as following:
internal int hour;
internal int minute;
And i have setters and getters setup.
You're trying to use the fields hour
and minute
when you probably meant to use the constructor parameters. You can't use fields (or any other instance members) when calling a base class constructor.
Personally I'd change the constructor parameters to have more conventional names:
public ExtendedTime(int hour, int minute, String timeZone) : base(hour, minute)
{
this.timeZone = timeZone;
}
Note that if you made your fields private instead of internal, the issue would have been more obvious, as you wouldn't have access to the fields in the first place :)
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