myVan.Speed);
Console.ReadLine();
}
Notice that although we have not added any members to the MiniVan class, we have direct
access to the public Speed property
of our parent class, and have thus reused code. Recall, however,
that encapsulation is preserved; therefore the following code results in a compiler error:
static void Main(string[] args)
{
Console.WriteLine("***** Basic Inheritance *****\n");
...
Do'stlaringiz bilan baham: