List of Exercises

Classes and Object in C#

	
namespace Classes_and_Object
{
  public partial class Form1 : Form
  {
    public Form1()
    {
      InitializeComponent();
      string name = "John";
      Car[] cc = new Car[2];
      cc[0] = new Car() { color = "red", type = "bmw" };
      cc[1] = new Car() { color = "red", type = "kia" };
      var ex1 = cc[0].exist();
      var ex2 = cc[1].exist();
      cat.color = "Blue";

    }
  }
  public class Car
  {
    public string color { get; set; }
    public string type { get; set; }

    public bool exist()
    {
      if (color == "red" & type == "bmw")
        return false;
      else
        return true;
    }
  }

  public static class cat
  {
    public static string color = "gray";

  }

}

	


Download the project of Visual Studio 2013 in DropBox Download


Classes and Object in C# | static classes


Video Thumbnail