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);

}
}
April 19th 20 at 12:07
2 answers
April 19th 20 at 12:09
Solution
Well, Trucks in the Cars you have declared. Hence it should be used as Cars.Trucks. Or take out Trucks separately.
The remaining error is the consequence.
Such a stupid mistake I did. Thanks for the help - Adolphus_Larkin commented on April 19th 20 at 12:12
April 19th 20 at 12:11
Solution
class Trucks declared as a class member Cars -
to make as a separate class
aYkTuws.png
Such a stupid mistake I did. Thanks for the help - Adolphus_Larkin commented on April 19th 20 at 12:14
@Adolphus_Larkin,
not gods pots (C)
for one learn how to understand error messages
good luck! - Noel.Gleason commented on April 19th 20 at 12:17
@Noel.Gleason, thanks :) - Adolphus_Larkin commented on April 19th 20 at 12:20

Find more questions by tags C#