Opis forum
Cwiczenia grupa C
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication3
{
class PROGRAM{
static void Main(string[] args){
ZIEMIA B = new ZIEMIA(1111);
Console.WriteLine("Masa={0}", B.MASA);
KSIEZYC A = new KSIEZYC(0);
Console.WriteLine("Masa={0}", A.MASA);
Console.ReadLine();
}
abstract class PLANETA{
private int PMASA;
public PLANETA(int M) { PMASA = M; }
public int MASA
{
get { return PMASA; }
set { PMASA = value; }
}
}
class ZIEMIA : PLANETA{
public ZIEMIA() : this(0) { }
public ZIEMIA(int M) : base(M) { }
}
class KSIEZYC : PLANETA{
public KSIEZYC() : this(0) { }
public KSIEZYC(int M) : base(M) { }
}
}
}
Offline