Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5957053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:20:45+00:00 2026-05-22T18:20:45+00:00

i have created a class and with that class i passed constructor and then

  • 0

i have created a class and with that class i passed constructor and then i made that class abstract class, but when i want to get 1 attribute of the abstract class from the inherit class it showing some error can not take argument 0

public class Device1
{
    public int dwMachineNumber;
    public int dwBaudrate;
    public int dwCommPort;
    public string dwIPAddress;
    public int dwPort;
    public int dwPassWord;

    public Device1(int dwMachineNumber)
    {
        this.dwMachineNumber = dwMachineNumber;
    }

    public Device1(int dwMachineNumber, int dwBaudrate, int dwCommPort, string dwIPAddress, int dwPort, int dwPassWord)
    {
        this.dwMachineNumber = dwMachineNumber;
        this.dwBaudrate = dwBaudrate;
        this.dwCommPort = dwCommPort;
        this.dwIPAddress = dwIPAddress;
        this.dwPort = dwPort;
        this.dwPassWord = dwPassWord;
    }

}

public class EnableMachine : Device1
{
    public int Device_Busy; //if 0 busy and 1 not busy 

    public EnableMachine(int dwMachineNumber, int Device_Busy)
    {
        this.Device_Busy = Device_Busy;
        this.dwMachineNumber = dwMachineNumber;
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T18:20:46+00:00Added an answer on May 22, 2026 at 6:20 pm

    Try this:

    public class EnableMachine : Device1
    {
        public int Device_Busy; //if 0 busy and 1 not busy 
    
        public EnableMachine(int dwMachineNumber, int Device_Busy) 
            : base(dwMachineNumber)
        {
            this.Device_Busy = Device_Busy;
        }
    }
    

    EDIT:

    When calling the constructor of a derived class, it also tries to call the constructor of the base class. Since you just had:

    public EnableMachine(int dwMachineNumber, int Device_Busy)
    {...}
    

    it by default tries to call the parameterless constructor Device() but Device1 does not have a parameterless constructor; hence the error “..does not contain a method accepting 0 arguments”.

    You need to tell it to use the constructor accepting the dwMachineNumber argument by adding the line

    : base(dwMachineNumber)
    

    to your derived class’s constructor. So, effectively, when you instantiate the derived class, it takes the dwMachineNumber argument and trunks it through to the base class’s constructor.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a collection of classes that inherit from an abstract class I created.
I have created a class that derives from TThread, because I wish to do
I have a control that is created like so: public partial class MYControl :
I have a class that creates several IDisposable objects, all of these objects are
I have a PHP class that creates a PNG image on the fly and
I have a class Page that creates an instance of DB , which is
I have created a class for a dashboard item which will hold information such
I have created UITableCellView class called NoteCell . The header defines the following: #import
I have created a class library in VB .NET. Some code in the library
I have created a C# class file by using a XSD-file as an input.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.