Ссылка типа object на объект класса - C#
Формулировка задачи:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
static void Main(string[] args)
{
object a = new Player();
a.
}
}
class Player
{
public int number;
}Решение задачи: «Ссылка типа object на объект класса»
textual
Листинг программы
class Program
{
static void Main(string[] args)
{
A b = new B();
A c = new C();
A d = new D();
b.x = 10;
c.x = 20;
d.x = 30;
Console.WriteLine("{0}\n{1}\n{2}\n",b.x, c.x, d.x);
Console.ReadLine();
}
}
class A
{
public int x;
}
class B:A
{
}
class C:A
{
}
class D:A
{
}