using System;
using System.Linq;
using Microsoft.Extensions.DependencyInjection;
namespace test3
{
class Program
{
static void Main()
{
//HelloWorldWithWriter_Example();
//HelloWorldWithDecorator1_Example();
//HelloWorldWithManyWriters_Example();
//HelloWorldWithAdapter_Example();
//BankOperationReaderApp_Example2();
String news = "new string";
var IrisEmployee = new Employee("James Peters", "IRIS Software");
Console.WriteLine(IrisEmployee.FName);
Console.WriteLine("\nPress any key...");
Console.ReadLine();
}
class Person
{
int age = 1;
public virtual int Age
{
get => age;
set{ if(value > 0 && value < 110) age = value; }
}
public string Name { get; set; }
public Person(string name)
{
Name = name;
}
public virtual void Print() => Console.WriteLine(Name);
}
class Employee : Person
{
public string FName { get; set; }
public override int Age
{
get => base.Age;
set { if (value > 17 && value < 110) base.Age = value; }
}
public string Company { get; set; }
public Employee(string fName, string company)
{
FName = fName;
Company = company;
base.Age = 18; // возраст для работников по умолчанию
}
}
}
}