C # "An object reference is required for a non-static field, method or property"

Having the same problem, 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)there is where I have such an error. Says the same problem for both hour and minute. Now, as a rule, I would say that I am missing something far as a property, but I tried it, and it did not bring sadness. in the parent class, the hour and minute are declared as follows:

    internal int hour;
    internal int minute;

And I have settings for setters and getters.

+5
source share
4 answers

hour minute, , , . ( ) .

, :

public ExtendedTime(int hour, int minute, String timeZone) : base(hour, minute)
{    
    this.timeZone = timeZone;
}

, , , , :)

+17

:

Hour != hour
Minute != minute

public ExtendedTime(int hour, int minute, string timeZone) : base(hour, minute)
+1

, (# ), :

public ExtendedTime(int hour, int minute, String TimeZone) :base(hour, minute)
0

, int Hour, int Minute, String TimeZone . , .

0

All Articles