Project 4. CS OOP
using System;
class APerson {
virtual public string WashDishes() {
return "dry and wet";}
}
class AWoman:APerson {
override public string WashDishes() {
return "wet";}
}
class AMan:APerson {
override public string WashDishes() {
return "dry";}
}
public class Program
{
static string result;
static void ViewModel(){
Model();
View();
}
static void Model(){
APerson masha = new AWoman();
APerson grisha = new AMan();
APerson[] family = new APerson[2];
family[0]=masha;
family[1]=grisha;
result = " ";
for (int i = 0; i < 2; i++){
result += family[i].WashDishes()+" ";
}
}
static void View(){
Console.WriteLine(result);
}
public static void Main(string[] args)
{
ViewModel();
}
}