Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Child : Person
- {
- public Child(string name, int age)
- : base(name, age)
- {
- Age = age;
- }
- public override int Age
- {
- get
- {
- return base.Age;
- }
- set
- {
- if (Age >= 15)
- {
- throw new ArgumentException("Child's age must be less than 15!");
- }
- Age = value;
- }
- }
- }
Add Comment
Please, Sign In to add comment