Skip to main content
gamedev.net
🔒 Locked

[C#] - Noob constructor question

Started by brasslips2 2 replies 1.1k views
Original Post
brasslips2
brasslips2
I'm pretty new to C# and have an error that I don't understand...

Here is my error: error CS1729: 'LevelEditor.Graphics.GraphicsEngine' does not contain a constructor that takes '1' arguments

The weird part is that I DO have a constructor that takes 1 argument defined in my graphics engine class... Any help on this would be great! Thanks!

In main.cs:

static void Main(){     MainClass form = new MainClass(); // Create the form                 //Initialize the Engines     GraphicsEngine m_graphics = new GraphicsEngine(ref form);     ...}


In Graphics.cs
namespace LevelEditor.Graphics{    public class GraphicsEngine    {        private Device DX_Device = null;        GraphicsEngine(ref MainClass form)        {            if (InitializeDirect3D(ref form) == false)            {                MessageBox.Show("Could not initialize Direct3D.", "Error");                return;            }        }    }}
brasslips2
brasslips2
If I do that then I get this error:

error CS0051: Inconsistent accessibility: parameter type 'ref LevelEditor.MainClass' is less accessible than method 'LevelEditor.Graphics.GraphicsEngine.GraphicsEngine(ref LevelEditor.MainClass)'
brasslips2
brasslips2
Ahh nvm just needed to make MainClass public as well. Thanks a lot!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.