Answer the question
In order to leave comments, you need to log in
`
How to fix these errors?
How to fix these errors?
main.cs(40,5): error CS0246: The type or namespace name `Trucks' could not be found. Are you missing an assembly reference?
main.cs(41,5): error CS0841: A local variable `man' cannot be used before it is declared
main.cs(42,24): error CS0841: A local variable `man' cannot be used before it is declared
using System;
class Cars {
public int wheels = 4;
public int speed = 135;
public bool IsWorking = true;
public void SetValues (int speed, int wheels) {
this.speed = speed;
this.wheels = wheels;
}
public void GetValues () {
Console.WriteLine("Speed is - " + this.speed + ", wheels is - " + this.wheels);
}
public Cars(int speed, int wheels, bool IsWorking) {
this.speed = speed;
this.wheels = wheels;
this.IsWorking = IsWorking;
}
public Cars () {}
class Trucks : Cars {
public int passazir;
public Trucks(int speed, int wheels, bool IsWorking, int passazir) : base (speed, wheels, IsWorking) {
this.passazir = passazir;
}
}
}
class HelloWorld {
(39) static void Main() {
(40) Trucks man = new Trucks (130, 8, true, 4);
(41) man.GetValues();
(42) Console.WriteLine (man.passazir);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question