Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ConsoleApplication1
- {
- class Elso
- {
- protected int a, b;
- public void Be_a(int x)
- {
- a = x;
- }
- public void Be_b(int x)
- {
- b = x;
- }
- public void Be_ab(int x, int y)
- {
- a = x;
- b = y;
- }
- public int Ki_a()
- {
- return a;
- }
- public int Ki_b()
- {
- return b;
- }
- public int Kerulet()
- {
- return 2 * (a + b);
- }
- }
- class Masodik : Elso
- {
- public int Kerulet()
- {
- return a + b;
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- List<Masodik> teglalap = new List<Masodik>();
- int? akarmi = 3;
- for (int i = 0; i < 5; i++)
- {
- Masodik x = new Masodik();
- x.Be_ab(i + 1, i + 1);
- teglalap.Add(x);
- }
- foreach (Masodik x in teglalap)
- {
- Console.WriteLine(x.Kerulet());
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement