//constructor using user input data
        public MotorVehichle(double tankVolume, string brand, string model, short year, string generalConditionATM)
        {
            RegNum     = Convert.ToString(uniqueNum.ToString("D4"));            //setting the registration number value using the unique number generator for the class
            TankVolume = tankVolume;                                            //setting the tank volume to the input
            uniqueNum++;                                                        //increasing the unique number value so it stays unique

            Brand = brand;                                                      //setting the brand value to the input
            Model = model;                                                      //setting the model value to the input
            Year  = year;                                                       //setting the year value to the input

            additionalInfo = new AdditionalInfo(generalConditionATM);           //setting the additional info using its constructor with input
        }
        private short year; //the year the vehicle was created

        #endregion Fields

        #region Constructors

        //constructor using user input data
        public MotorVehichle( double tankVolume, string brand, string model, short year, string generalConditionATM )
        {
            RegNum =        Convert.ToString( uniqueNum.ToString( "D4" ) );     //setting the registration number value using the unique number generator for the class
            TankVolume =    tankVolume;                                         //setting the tank volume to the input
            uniqueNum++;                                                        //increasing the unique number value so it stays unique

            Brand =             brand;                                          //setting the brand value to the input
            Model =             model;                                          //setting the model value to the input
            Year =              year;                                           //setting the year value to the input

            additionalInfo =    new AdditionalInfo( generalConditionATM );      //setting the additional info using its constructor with input
        }
 //copy constructor
 public AdditionalInfo( AdditionalInfo other )
     : this(other.generalConditionATM)
 {
 }
Exemplo n.º 4
0
 //copy constructor
 public AdditionalInfo(AdditionalInfo other) : this(other.generalConditionATM)
 {
 }