【发布时间】:2011-01-03 15:24:33
【问题描述】:
class Frame
{
static int X;
static int Y;
static uint Color;
static protected bool Check()
{
return (Coords.GetPixelColor(X, Y) == Color);
}
}
class frameBeginning : Frame
{
static int X = 1;
static int Y = 2;
static int Color = 3;
}
frameBeginning.Check(); 无法编译,因为Check() 因其保护级别而无法访问。
但是为什么,Check() 受到保护?
【问题讨论】:
-
大小是正确的。顺便说一句,您应该使用编码标准。通常,类以大写字母开头。如果你不喜欢这样,至少在所有地方都保持一致(Frame vs frameBeginning)。