473,404 Members | 2,213 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,404 software developers and data experts.

About multi-Inherits

Hi all,
I had made a UserControl, and I want to inherits panel,label,button and
linklabel from my class. But when I typed the code like
====
public class A :
System.Windows.Forms.UserControl,System.Windows.Fo rms.Panel,
System.Windows.Forms.Button,System.Windows.Forms.L abel,System.
Windows.Forms.LinkLabel
.....

======

There is an error to me. It said thoes were not interface,and I couldn't
inherits them.

How can I solve this problem?
Nov 16 '05 #1
3 1228
Hello Jet,

C# does not support multiple inheritance of classes, only interfaces. Since
they are not interfaces, you get this error.
You can't solve this problem - unless you inherit interfaces.

Good luck,

Razzie

"Jet Leung" <xi**@tom.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi all,
I had made a UserControl, and I want to inherits panel,label,button and
linklabel from my class. But when I typed the code like
====
public class A :
System.Windows.Forms.UserControl,System.Windows.Fo rms.Panel,
System.Windows.Forms.Button,System.Windows.Forms.L abel,System.
Windows.Forms.LinkLabel
....

======

There is an error to me. It said thoes were not interface,and I couldn't
inherits them.

How can I solve this problem?

Nov 16 '05 #2
Hi Jet,

You can only inherit from one single class in C#.
You can, however, inherit from multiple interfaces and the syntax to do so is how you wrote your class

public class A : BaseClass, Interface1, Interface2, Interface3 ...
{
}

So the compiler expects Panel, Button, Label, linkLabel to be interfaces, which they are not.

You need to rethink your strategy. Why do you want to inherit from all the classes.

--
Happy coding!
Morten Wennevik [C# MVP]
Nov 16 '05 #3
I had made a UserControl, and I want to inherits panel,label,button and
linklabel from my class.


Are you sure you don't want your control to *contain* these other
controls? Even if C# and the CLR supported multiple inheritance (which
they don't), what kind of behavior would you expect this control to
have?

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 16 '05 #4

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

Similar topics

0
by: frankenberry | last post by:
I have multi-page tiff files. I need to extract individual frames from the multi-page tiffs and save them as single-page tiffs. 95% of the time I receive multi-page tiffs containing 1 or more black...
6
by: cody | last post by:
What are multi file assemblies good for? What are the advantages of using multiple assemblies (A.DLL+B.DLL) vs. a single multi file assembly (A.DLL+A.NETMODULE)?
0
by: frankenberry | last post by:
I have multi-page tiff files. I need to extract individual frames from the multi-page tiffs and save them as single-page tiffs. 95% of the time I receive multi-page tiffs containing 1 or more black...
6
by: cody | last post by:
What are multi file assemblies good for? What are the advantages of using multiple assemblies (A.DLL+B.DLL) vs. a single multi file assembly (A.DLL+A.NETMODULE)?
0
by: Sabri.Pllana | last post by:
We apologize if you receive multiple copies of this call for papers. *********************************************************************** 2008 International Workshop on Multi-Core Computing...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.