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

  • Home
  • SEARCH
  • 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 8374469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:55:48+00:00 2026-06-09T14:55:48+00:00

I am trying to create a setup for a class I am making so

  • 0

I am trying to create a setup for a class I am making so when it is created a manager class can be setup for it, and it might require to call functions in that class via an interface

These calls are not always required, and the manager may not always be the class that called this class, so a simple return value and use it form the manager class does not meet the requirements.

What I am trying to do is following code. (Tried to strip as much unnecessary out as possible)

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    interface Itester
    {
        void LoadTest();
    }


    public partial class Form1 : Form, Itester
    {

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {

            World testWorld = new World();
        testWorld.SetManager(this);
            testWorld.InitializeWorld();

        }


        void Itester.LoadTest()
        {
            //random action I want run
            label1.Text = "Ran LoadTest()";
        }

    }


    public class World
    {
        Itester worldManager;

        public World()
        {
            InitializeWorld();
        }

        private void InitializeWorld()
        {
            worldManager.LoadTest();
        }

        public void SetManager(Itester test)
        {
            worldManager = test;
        }

    }

}

I get this error based on it. The error refer to the “public void in the World class”

Error 1 Inconsistent accessibility: parameter type ‘WindowsFormsApplication1.Itester’ is less accessible than method ‘WindowsFormsApplication1.World.SetManager(WindowsFormsApplication1.Itester)’ XYZ Location Form1.cs 316 21 Feudal World

What I would have expected to happen was that.

Form1 class creates a local instance of the World Class, then runs its constructor (does nothing), then it sets itself as its Manager (could in theory be another class implementing the Itester interface), finally it calls the World Class again and ask it to initialize the world, where I would have expected the world class to call the Form1 instance and have it update the label on the button.

lvl1:Form1 -> lvl2:World -> lvl3:Form1(or other manager) -> return void to lvl2:World -> return void to lvl1:Form1

What am I missing, why does this not work?

  • 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-09T14:55:49+00:00Added an answer on June 9, 2026 at 2:55 pm

    Your interface does not have accessibility modifier, so it is assumed internal. Change it to public:

    public interface Itester
    {
        void LoadTest();
    }
    

    The reason you need to do this is because the method SetManager is public, thus anyone that can consume the SetManager method must also be able to see the interface.

    now I just need to figure out why it works

    Consider that SetManager can be called from any assembly because it is public. So if someone were creating an assembly, they could reference yours and call worldInstance.SetManager. Let’s call that assembly BigHappyAssembly.

    Now consider the first parameter of SetManager is ITester, however it is internal. When BigHappyAssembly tries to call SetManager, it would be presented with a problem: What am I suppose to give as the first parameter? It doesn’t have access to the ITester type, so it doesn’t know that is what the first parameter is.

    To prevent this happening in the first place, the compiler stops you from introducing this problem. It’s warning you that you have created a public member, that anyone can call, however not everyone will be able to know what the parameters are.

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

Sidebar

Related Questions

I'm trying to create a extended CCSprite class that can detect touches. I have
I am trying to create a custom dialog class that inherits from Dialog that
OK so im trying to create a settings class to store certain strings that
At the moment I am trying to create a setup where page content is
I'm trying to create a very basic Setup and Deployment project using Visual Studio.
I setup a Paypal Sandbox account and am trying to create simple purchases through
I'm trying create a bot which automatically likes Facebook posts. Using Mechanize I can
I followed this tutorial and I'm currently trying to create a class to draw
I'm trying to create a test class which organizes its test methods using inner
I'm getting a java.lang.noclassdeffounderror when trying to create a mock class for Component using

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.