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;
- using System.Threading.Tasks;
- namespace OOP_Principles2
- {
- class Shapes
- {
- public abstract class Shape
- {
- private double width;
- private double height;
- private double surface;
- public Shape(double width, double height)
- {
- this.width = width;
- this.height = height;
- }
- public double Width
- {
- get { return this.width; }
- private set
- {
- if (value <= 0)
- {
- throw new ArgumentException("Width cant be less or equal of 0");
- }
- this.width = value;
- }
- }
- public double Height
- {
- get { return this.height; }
- private set{
- if(value <= 0)
- {
- throw new ArgumentException("Height cant be less or equal of 0");
- }
- this.height = value;
- }
- }
- public double Surface
- {
- get { return this.surface; }
- protected set
- {
- this.surface = value;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement