02/03/2010
class A
{
public int i=10;
public static int j=20;
public void xyz
{
Console.WriteLine("xyz");
}
public static void abc()
{
Console.WriteLine("abc");
}
}
class B
{
A a=new A();
a.i=20; OK
a.j=20; NG (j is static)
}
class Program
{
Public static void Main()
{
Console.WriteLine(j)
}
}
class B:A
{
int k=20;
}
class Program
public static void()
{
B b=new B();
Console.WriteLine(b.j); error (j is static)
}
}
class B:A
{
protect int k=20;
}
class Program
{
static void Main()
{
B b=new B();
b.i;
b.xyz();
}
}
class can't have more than one class.
inheritance: multiple
multiple | A -- B:A |
C:A |
interface: multilevel
multilevel A
↓
B
↓
C
↓
D
0 件のコメント:
コメントを投稿