August 2017
Beginner
566 pages
12h 34m
English
For review, a complete version of Vehicles.cs for this lesson is displayed in the following code block:
/// <summary>/// Summary description for Vehicles/// </summary>public class Vehicles{ private string make;//instance variables private string model; //set instance variables inside constructor public Vehicles(string mk, string mod) { make = mk; model = mod; } //make function to get vehicle make public string GetMake() { return make; }} //truck inherits from Vehicles because it's a kind of vehiclepublic class Truck : Vehicles{ public Truck(string mk, string mod) : base(mk, mod) { } public string GetTruckMake() { return GetMake(); }} //Sedan inherits from Vehicles because it's a kind of vehiclepublic class Sedan : VehiclesRead now
Unlock full access