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 8409167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:49:49+00:00 2026-06-09T23:49:49+00:00

please bear with me as I’m just learning C#. Just messing around with C#

  • 0

please bear with me as I’m just learning C#. Just messing around with C# I decided to come up with an inventory system to test out but I have one problem in my script:

using System;
using System.Collections.Generic;


public class Item
{
    public String name;
    public int pesos;

    public int getPesos()
    {
        return pesos;
    }
    public String getName()
    {
        return name;
    }
}
public class statuseffect
{
    statuseffect(string Effect,int Amount,int Duration)
    {
        string effect = Effect;
        int amount = Amount;
        int duration = Duration;
    }
}
public class Potion : Item 
{
    public int hpeffect;
    public int mpeffect;
    List<statuseffect> effects = new List<statuseffect>();


    public Potion(int hp,int mp)
    {
        hpeffect = hp;
        mpeffect = mp;
    }
    public void addEffect(statuseffect eff)
    {
        effects.Add(eff);
    }
}
class game
{
public static void Main()
    {   
        Potion healthPotion = new Potion(200,50);
        healthPotion.pesos = 23;
        Console.WriteLine(healthPotion.hpeffect);
        statuseffect slow = new statuseffect("slow",10,30);
    }
}

in the last line the compiler tells me that statuseffect does not contain a constructor that takes 3 arguments. From what I can tell, it does contain 3 arguments. Is there something I am missing here?

as a side note. if you guys have any comments or suggestions for my script, that would be helpful as well.

  • 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-06-09T23:49:50+00:00Added an answer on June 9, 2026 at 11:49 pm

    Your constructor is private and therefore “invisible” to code outside the class itself. Try adding the keyword internal before the constructor. Or, if it needs to be visible from other projects as well, add public instead.

    Another issue: In your class statuseffect, you declare three local variable inside your constructor. Those variable’s only scope is the constructor. You must move their declarations out of the constructor (then they become instance fields of the class). The constructor can still assign to them.

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

Sidebar

Related Questions

Please bear with me, newbie just learning the ropes. I am getting the below
I am a beginner in Haskell so please bear with me. (Just started learning
Please bear with me, I'm just learning C++. I'm trying to write my header
Please bear with me, as I'm a programming/cakephp noob, but I do not know
I'm new to iPad development so please bear with me. I have an iPad
I am new to iOS development so please bear with me. I have created
This is kinda confusing so please bear with me. I have an array (listOfStates)
Please bear with me, since I am just getting started with Pyramid. I am
I have a few questions so please bear with me. I need some help
Please bear with me as I've just started using NetBeans for the first time!

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.