Resolve error ‘there is no argument given that corresponds to required formal parameter’?

Fixing your bug:

The error occurs due to the lack of a parameterless constructor (or your lack of using the base() method in your constructor (just like user3185569 had said)

Fixing your code:

It clearly seems you are lacking some basics in .NET so I’ve decided to give a re-writing to your code with the following things in mind:

a. Conventions

There are some rules about common conventions that should apply to your code.

Members usually begin with either m or _ and then the memberName (camel casing).

Properties are usually written regularly as PropertyName and same applies to methods.

Parameters and variables are simply camel cased like parameterName

b. Access Modifiers

I don’t know the use of your Oval and circle but I assume you’d want to access them outside of Oval and Circle.

I think it would be the best to reference you to here to read some more about the topic: https://msdn.microsoft.com/en-us/library/ms173121.aspx

I’ve re-written your code to include all those tips (and also fix your issue)

public class Oval:Shape
{       
    //Constructor
    public Oval(double majorAxis, double minorAxis)
    {
        MajorAxis=majorAxis;
        MinorAxis=minorAxis;
    } 
    
    protected double MajorAxis{ get; set; }     
    protected double MinorAxis{ get; set; }     
}    

public class Circle:Oval
{       
    //Constructor
    public Circle(double radius): base(radius,radius)
    {
        radius = Circle_Radius;  
    }
    
    public double Radius
    {
        get
        {
            return MajorAxis;
        }
        set
        {
            MajorAxis = value;
            MinorAxis = value;
        }       
    }
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)