コード例 #1
0
        public override string ToString()
        {
            StringBuilder vehicleStringData = new StringBuilder();

            vehicleStringData.Append(base.ToString() + "\n");
            vehicleStringData.Append(m_WheelData.ToString() + "\n");
            vehicleStringData.Append("Number Of Doors: " + m_NumberOfDoors + "\n");
            vehicleStringData.Append("Car Color: " + m_CarColor);

            return(string.Format(vehicleStringData.ToString()));
        }
コード例 #2
0
        public override string ToString()
        {
            StringBuilder vehicleStringData = new StringBuilder();

            vehicleStringData.Append(base.ToString() + "\n");
            vehicleStringData.Append(m_WheelData.ToString() + "\n");
            vehicleStringData.Append("License Type: " + m_TypeOfLicense + "\n");
            vehicleStringData.Append("Engine Size: " + m_EngineSize);

            return(string.Format(vehicleStringData.ToString()));
        }
コード例 #3
0
        public override string ToString()
        {
            StringBuilder vehicleStringData = new StringBuilder();

            vehicleStringData.Append(base.ToString() + "\n");
            vehicleStringData.Append(m_WheelData.ToString() + "\n");
            vehicleStringData.Append(m_FuelData.ToString() + "\n");
            vehicleStringData.Append("Trunk Volume: " + m_TrunkVolume + "\n");
            vehicleStringData.Append("Driving hazardous materials? : " + m_IsDrivingHazardousMaterial);

            return(string.Format(vehicleStringData.ToString()));
        }
コード例 #4
0
        public override string ToString()
        {
            return(string.Format(
                       @"
Car
----------------------------
Model:                   {0}
License number:          {1}
{2}
Number of wheels:        {3}
{4}
Color: {5}
Number of Doors:  {6}",
                       ModelName,
                       LicenseNumber,
                       Engine.ToString(),
                       k_NumOfWheels,
                       Wheel.ToString(),
                       m_CarColor,
                       m_NumOfDoorsInCar));
        }
コード例 #5
0
ファイル: Truck.cs プロジェクト: OrSasson/Ex_03
        // Overriding object's ToString() method.
        public override string ToString()
        {
            return(string.Format(
                       @"
Truck
-----
Model:                   {0}
License number:          {1}
{2}
Number of wheels:        {3}
{4}
Maximum carrying weight: {5}
Has dangerous material:  {6}

",
                       ModelName,
                       LicenseNumber,
                       Wheel.ToString(),
                       k_NumOfWheels,
                       Engine.ToString(),
                       m_MaxLoadingWeight,
                       m_CarryigHazardousMaterial));
        }
コード例 #6
0
        // Overrding Object's method.
        public override string ToString()
        {
            return(string.Format(
                       @"
Motorcycle
----------
Model:             {0}
License number:    {1}
{2}
Number of wheels:  {3}
{4}
License Type:      {5}
Engine Volume:     {6}

",
                       ModelName,
                       LicenseNumber,
                       Wheel.ToString(),
                       k_NumOfWheels,
                       Engine.ToString(),
                       m_LicenseType,
                       m_EngineVolume));
        }