Problem with base constructor

  • Thread starter Thread starter Paul E Collins
  • Start date Start date
P

Paul E Collins

I want to create a class that inherits from Menu and whose constructor
calls the parameterless Menu constructor.

Why does this code produce CS1501 ("No overload for 'Menu' takes '0'
arguments")? How can I correct it?

public class DerivedMenu : System.Windows.Forms.Menu
{
public DerivedMenu(string xyz) : base()
{
// some code here
}
}

P.
 
Paul,

The Menu class does not have a base constructor that takes zero
arguments. You need to pass the items parameter in, which is an array of
MenuItem instances.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top