Reputation: 1974
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.
Upvotes: 5
Views: 2731
Reputation: 1754
Clearly, int Hour, int Minute, String TimeZone
are not proper parameters. Use object names in parameters, not their Class.
Upvotes: 0
Reputation: 1500035
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 :)
Upvotes: 18
Reputation: 19692
I think you might be having a casing problem (c# is case sensitive), try this:
public ExtendedTime(int hour, int minute, String TimeZone) :base(hour, minute)
Upvotes: 0
Reputation: 61589
You're not passing your arguments:
Hour != hour
Minute != minute
Change it to
public ExtendedTime(int hour, int minute, string timeZone) : base(hour, minute)
Upvotes: 1