Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace lab4var28
- {
- abstract public class База
- {
- protected int[] массив;
- public База( int _размер_массива ){
- массив = new int[ _размер_массива ];
- размер_массива = _размер_массива;
- }
- public int размер_массива
- { get; set; }
- public abstract void Печать();
- public int this[ int i ]
- {
- get => массив[ i ];
- set => массив[ i ] = value;
- }
- }
- public class Производный : База
- {
- public Производный( int размер_массива ) : base( размер_массива ){ }
- public override void Печать(){
- foreach( var i in массив ){
- Console.Write( i );
- Console.Write( ' ' );
- }
- Console.WriteLine();
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- Производный массив = new Производный( 3 );
- массив[0] = 1;
- массив[1] = 5;
- массив[2] = массив[0] + массив[1];
- массив.Печать();
- }
- }
- }
Add Comment
Please, Sign In to add comment