473,503 Members | 1,617 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

inheriting from a base class and using an interface

I have a class which is implementing an interface, but I also want to have
it inherit from a base class. Can you do both with a class? If so, what's
the syntax?

thanks.
Nov 13 '05 #1
3 18247
public class NewClass : theBase, theInterface
{
//code
}
"Mark" <ma*****@kc.rr.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
: I have a class which is implementing an interface, but I also want
to have
: it inherit from a base class. Can you do both with a class? If so,
what's
: the syntax?
:
: thanks.
:
:
Nov 13 '05 #2

Awesome. thanks!
"Chris Barrell" <no@spam.com> wrote in message
news:OK****************@tk2msftngp13.phx.gbl...
public class NewClass : theBase, theInterface
{
//code
}
"Mark" <ma*****@kc.rr.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
: I have a class which is implementing an interface, but I also want
to have
: it inherit from a base class. Can you do both with a class? If so,
what's
: the syntax?
:
: thanks.
:
:

Nov 13 '05 #3
Mark,
In addition to Chris's example, you can actually implement multiple
interfaces, but inherit from only one base class.

public class NewClass : theBase, theFirstInterface, theSecondInterface
{
//code
}

Hope this helps
Jay

"Mark" <ma*****@kc.rr.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I have a class which is implementing an interface, but I also want to have
it inherit from a base class. Can you do both with a class? If so, what's
the syntax?

thanks.

Nov 13 '05 #4

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

Similar topics

15
1682
by: JustSomeGuy | last post by:
this doesn't want to compile.... class image : public std::list<element> { element getElement(key k) const { image::iterator iter; for (iter=begin(); iter != end(); ++iter) { element...
11
2145
by: Noah Coad [MVP .NET/C#] | last post by:
How do you make a member of a class mandatory to override with a _new_ definition? For example, when inheriting from System.Collections.CollectionBase, you are required to implement certain...
2
1819
by: Simon | last post by:
Hi, Just to get started.... I've created a very simple web form, "Simple", using VS and I dropped a HTML img control on the design view. I referenced a picture and it is displayed in browser...
1
336
by: Matthew Roberts | last post by:
Howdy Everyone, I am having trouble understanding the process of creating a type-safe collection by inheriting from the CollectionBase class. I have done it plenty of times, but now that I sit...
2
1472
by: Charles Law | last post by:
I have a base class - ComponentBase - that inherits from UserControl. My class implements IComponentBase, which defines a minimal set of core properties and methods. All my other components inherit...
1
1824
by: jbzdak | last post by:
Recently, I have been learning Java (it is one of laboratories on my department), well I know Java is awfully slow, but it is not the point that I'm interested. Java has a keyword "interface. (and...
0
1204
by: damianmatiasmax | last post by:
Helow, Good days. I am creating a class Base in VB.NET, then I use this class base to create to the class son across inherits, and Then generate the object COM this class son to be used in VB6....
10
1724
by: Brett Romero | last post by:
Say I have a class inheriting some base class: BaseClass { void Foo() { Update(); } }
4
1678
by: AalaarDB | last post by:
struct base { int x, y, z; base() {x = 0; y = 0; z = 0;}; base(int x1, int y1, int z1) {x = x1; y = y1; z = z1;}; }; struct intermediate1 : public virtual base {}; struct intermediate2 :...
0
7202
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
7278
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
7328
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
7458
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
5578
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,...
1
5013
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...
0
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.