Home c# Error: CS7036 There is no argument that corresponds to the required formal...

Error: CS7036 There is no argument that corresponds to the required formal parameter

Author

Date

Category

What’s wrong with my code?

looked different solutions, did not understand. There is no argument, “name” from “drone.drone.

class program
{
 Static Void Main (String [] Args)
  {
    Vehicle drone = new drive ();
    Vehicle Archer = New Archer ();
    drone.displayInfo ();
    Archer.DisplayInfo ();
    Console.ReadKey ();
  }
}
 class vehicle.
{
  Public String Name {Get; SET; }
  Public String Weapon {Get; SET; }
  Public int PowerScore {Get; SET; }
  Public int ENGENEPOWER {Get; SET; }
  Public int vehicleid {get; SET; }
  Public Vehicle ()
  {}
  Public Virtual Void DisplayInfo () {}
}
 Class Drone: Vehicle
{
  Public Drone (String Name, Int Vehicleid, String Weapon, Int Powerscore, Int EngenePower)
  {
   Vehicleid = 001; name = "droncarrier"; Powerscore = 5000; weapon = "drone fuse"; engenepower = 540;
  }
  Public Override Void DisplayInfo ()
  {
   Console.WRITELINE (VEHICLEID + "WITH" + NAME + "HAS" + POWERSCORE + "AND CARRYS WEAPON" + WEAPON + "ENGINE" + ENGENEPOWER);
  }
}
 Class Archer: Vehicle
{
  Public Archer (String Name, Int Vehicleid, String Weapon, Int PowerScore, Int EngenePower)
  {
   Vehicleid = 003; Name = "miniarcher"; Powerscore = 5000; weapon = "crossbow"; engeneepower = 430;
  }
  Public Override Void DisplayInfo ()
  {
    Console.WRITELINE (VEHICLEID + "WITH" + NAME + "HAS" + POWERSCORE + "AND CARRYS WEAPON" + WEAPON + "ENGINE" + ENGENEPOWER);
  }
}

Answer 1, Authority 100%

Drone and Archer Constructors only with parameters, what and says the compiler. But there is no error about Name in the given code.

https://ideone.com/ix8ea2

prog.cs (5,25): Error CS1729: The Type `Drone ‘Does Not Contain A Construction That Takes`’ arguments
Prog.cs (26,12): (Location of the Symbol Related to Previous Error)

prog.cs (6,26): Error CS1729: The Type` Archer ‘Does Not Contain A Construction That Takes`’ arguments
Prog.cs (37,12): (Location of the Symbol Related to Previous Error)

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions