דגד
דגדג
Posted in C#, on September 10, 2013 at 13:17
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AndreiProject
{
    class Date
    {
        //Fields
        private int day;
        private int month;
        private int year;


        //Constructors
        public Date(int d, int m, int y)
        {
            this.day = d;
            this.month = m;
            this.year = y;
        }

        //Inner Calling Constructor + Overloading (GIVES INIT - ZERO VALUES TO ALL VARS IF NOTHING SELECTED IN OVERLOADING)
        public Date()
            : this(0,0,0)
        {
        }

        //ToString
        public override string  ToString()
        {
 	         return (this.day + "/" + this.month + "/" + this.year + ".");
        }

     
        //Properties
        public int Day
        {
            get { return day; }
            set { day = value; }
        }

        public int Month
        {
            get { return month; }
            set { month = value; }
        }

        public int Year
        {
            get { return year; }
            set { year = value; }
        }

        //Checking Properties Values (if?, IsXOK?)
        

    }
}

Share this code

| More

Use the link below to share the code:
HTML
BBCode