static void Main(string[] args) { dynamic typeVariable = 100; Console.WriteLine(typeVariable + typeVariable.GetType().ToString()); typeVariable = "Hello"; Console.WriteLine(typeVariable + typeVariable.GetType().ToString()); typeVariable = true; Console.WriteLine(typeVariable + typeVariable.GetType().ToString()); Console.ReadLine(); CoordinatePoint classCoordinate = new CoordinatePoint(.82F, .34F); CoordinatePointStruct structCoordinate = new CoordinatePointStruct(.82F, .34F); Console.WriteLine("Initial Coordinates for Class are :" + classCoordinate.xCoordinate.ToString() + " " + classCoordinate.yCoordinate.ToString()); Console.WriteLine("Initial Coordinates for Struct are :" + structCoordinate.xCoordinate.ToString() + " " + structCoordinate.yCoordinate.ToString()); ChangeValuesClass(classCoordinate); ChangeValuesStruct(structCoordinate); Console.WriteLine("Initial Coordinates for Class are :" + classCoordinate.xCoordinate.ToString() + " " + classCoordinate.yCoordinate.ToString()); Console.WriteLine("Initial Coordinates for Struct are :" + structCoordinate.xCoordinate.ToString() + " " + structCoordinate.yCoordinate.ToString()); Console.ReadLine(); CarA carA = new CarA(); carA.ImplementAccelerator(); carA.ImplementBrake(); carA.FoldableSeat(); CarB carB = new CarB(); carB.ImplementAccelerator(); carB.ImplementBrake(); carB.RoofTopExtendable(); Console.ReadLine(); }
static void ChangeValuesClass(CoordinatePoint obj) { obj.xCoordinate = .5F; obj.yCoordinate = .5F; }