コード例 #1
0
        //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
        }
コード例 #2
0
        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
        }
コード例 #3
0
 //copy constructor
 public AdditionalInfo( AdditionalInfo other )
     : this(other.generalConditionATM)
 {
 }
コード例 #4
0
 //copy constructor
 public AdditionalInfo(AdditionalInfo other) : this(other.generalConditionATM)
 {
 }