473,408 Members | 2,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Problem with base constructor

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.
Nov 16 '05 #1
3 948
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.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Paul E Collins" <fi******************@CL4.org> wrote in message
news:c8**********@sparta.btinternet.com...
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.

Nov 16 '05 #2
Paul E Collins <fi******************@CL4.org> wrote:
I want to create a class that inherits from Menu and whose constructor
calls the parameterless Menu constructor.


Which parameterless Menu constructor is that?

I can't see one in MSDN, and the compiler can't find one either.

See http://www.pobox.com/~skeet/csharp/constructors.html for more
information.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #3
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote:
Which parameterless Menu constructor is that?


Oops! Well, that answers my question. Thanks.

P.
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Christian Engström | last post by:
When i compile the program listed below with gcc version 3.3.1 (MinGW on Windows XP) I get the following result: Calling 'func(d)': 'base' copy constructor Calling 'func(*d_handle)': 'base'...
6
by: Nafai | last post by:
Hello. I want to do something like this: class A { // It's virtual protected: float* data; int n; public: A(int a); virtual float* createData(); //...
8
by: Sowen | last post by:
Hi, I have an object "elem", there are only simple functions inside, like setName, getName, and three constructors Now I have another class "Base", need an array of elem to initialize class...
4
by: Bangalore | last post by:
Hi all, I am finding quite difficulty in understanding the behaviour of the following program. Base class is singleton, so it should allow the creation of only one object. Eventhough it is...
6
by: Taran | last post by:
Hi All, I tried something with the C++ I know and some things just seem strange. consider: #include <iostream> using namespace std;
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.