Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp1
- {
- class num
- {
- protected int people, animal; //доступ открыт классам, производным от данного.
- public int plants;
- public void Set(int num1, int num2)
- {
- people = num1;
- animal = num2;
- }
- }
- class Animal : num //наследование класса num
- {
- public void show()
- {
- Console.WriteLine(people/animal);
- Console.WriteLine(people*plants);
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- num ob = new num();
- Animal or = new Animal();
- or.Set(10, 5);
- or.plants = 1000;
- or.show();
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement