473,322 Members | 1,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,322 software developers and data experts.

Inherit from Class and Interface

Hey,

I'm looking for the right syntax to inherit my class from an Interface and
a class at the same time:

__interface ITest
{

};

__gc class CTest
{

};

__gc CDerivedTest : public CTest , ITest
{

};

The upper syntax is slightly wrong and I can't get it to run.
How do I express inheritance from class and Interface at the same time?
Thanks, Sebastian
Nov 17 '05 #1
2 1181
Sebastian Dau wrote:
The upper syntax is slightly wrong and I can't get it to run.
How do I express inheritance from class and Interface at the same time?
Thanks, Sebastian


You need to add another public, as interfaces (just like __gc classes)
always require public inheritance.

__interface ITest {};
__gc class CTest {};
__gc CDerivedTest : public CTest , public ITest {};

--
Brandon Bray, Visual C++ Compiler http://blogs.msdn.com/branbray/
This posting is provided AS IS with no warranties, and confers no rights.
Nov 17 '05 #2
__gc CDerivedTest : public CTest , public ITest
{

};

Nov 17 '05 #3

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

Similar topics

4
by: Slavyan | last post by:
(I just started to learn C#.NET) What's the syntax in c# for a class to inherit more than one class. I know following syntax: public class MyClass : MyOtherClass { } but I need to inherit...
3
by: TruongLapVi | last post by:
Hi everybody, I have write customize attribute TestAttribute public class TestAttribute : Attribute { private string name; public TestAttribute(string name) {
2
by: Microsoft | last post by:
I have Interface defined with custom attribute. My class implements the same interface , but I'm not able to see any attributes derived from interface.( I did set the inherited to true) .
2
by: Carlos | last post by:
I would like to create a component that inherits from sqlconnection, but it is sealed. What ancestor can I inherit from? I've seen this: public sealed class SqlConnection : Component,...
5
by: john conwell | last post by:
I'm trying to make a class that already inherits from a base class, also inherit from an interface in managed C++. so my interface looks like so: __gc interface ITask { __property String*...
12
by: Mark Fink | last post by:
I wrote a Jython class that inherits from a Java class and (thats the plan) overrides one method. Everything should stay the same. If I run this nothing happens whereas if I run the Java class it...
2
by: Niklas | last post by:
Hi Is it possible in one way or another to enforce that a class only inherit from one of the derived interfaces of a base interface of some kind. For example. public class MyClass2 :...
2
by: harvie wang | last post by:
Hi, I want to implement a common Form with special interface, such as MovePoint(double,double). I create a interface first: namespace ABC.Test { public Interface IMyWindowInterface { void...
21
by: T.A. | last post by:
I understand why it is not safe to inherit from STL containers, but I have found (in SGI STL documentation) that for example bidirectional_iterator class can be used to create your own iterator...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.