2
Answers

Narrowed Down Problem - Need help with Interface Constructor

Ask a question
james niesen

james niesen

13y
2.1k
1
I'm storing the following information about a small car:
max speed = 100
fuel efficiency = 50
mpg = 30
reliability factor = 7

I have a class SmallCar that inherits a IVehicle interface.  I'm stuck on how to add the constructors.  Can someone please help:
[code]
namespace Assets.Classes
{
 public interface IVehicle
 {
 int MaxSpeed { get; set;}
 int FuelEfficiency {get; set;}
 double ReliabilityFactor { get; set; }
 
double LifeSpan { get; set; }
 }

 public class SmallCar : IVehicle
 {

 protected int maxSpeed { get; set; }
 
protected int fuelEfficiency { get; set; }
 
protected double reliabilityFactor { get; set; }
 
protected double lifeSpan { get; set; }

class SmallCar : IVehicle
        Here's where I'm stuck trying to add constructor logic
}

 }

 }


[/code]

Answers (2)