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 Forest
- {
- class Tree
- {
- #region Fields
- private string type;
- private double diameter;
- private double height;
- private static string color = "green";
- private static int counter = 0;
- #endregion
- #region Properties
- public string Type
- {
- get { return type; }
- set { type = value; }
- }
- public double Diameter
- {
- get { return diameter; }
- set { diameter = value; }
- }
- public double Height
- {
- get { return height; }
- set { height = value; }
- }
- public static string Color
- {
- get { return color; }
- set { color = value; }
- }
- public static int Counter
- {
- get { return counter; }
- }
- #endregion
- #region Constructors
- public Tree(string type, double diameter, double height)
- {
- this.type = type;
- this.diameter = diameter;
- this.height = height;
- counter++;
- }
- public Tree(double diameter, string type, double height)
- :this(type, diameter, height)
- { }
- public Tree()
- : this("Default", 0, 0)
- { }
- #endregion
- public void GetInfo()
- {
- Console.WriteLine("I am a tree. My type is = {0}. diameter = {1}, height = {2}, color = {3}", type, diameter, height, color);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment