Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Kalucki4_5
- {
- public class Program
- {
- public static void Main(string[] args)
- {
- Kwadrat kw = new Kwadrat(5);
- Console.WriteLine(kw.ToString());
- }
- }
- public interface IFigura
- {
- int Obwod { get; }
- int Pole { get; }
- }
- public class Kwadrat : IFigura
- {
- private int dlBoku;
- public Kwadrat(int dlBoku)
- {
- this.dlBoku = dlBoku;
- }
- public int Obwod
- {
- get
- {
- return 4 * dlBoku;
- }
- }
- public int Pole
- {
- get
- {
- return dlBoku * dlBoku;
- }
- }
- public override string ToString()
- {
- return "Kwadrat: " + dlBoku.ToString();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement