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* get_Subject();
};
and the class that inherits from it is defined like so:
public __gc class Message : public MsgObject, public ITask {
and the get_Subject property in the header file for Message looks like so:
__property String* get_Subject();
but no matter what i try, i cant get it to compile. I've played with every
combination of __gc, interface, __interface, public or not and no luck.
mostly i get a compile error stating that my Message class can only inherit
from one base class. but i've got the ITask defined as an interface. any
ideas?
thanks. 5 1764
ok...so i figured out i was miss-defining my interface. the following works
just fine:
public __gc __interface ITask
{
public public:
__property String* get_Subject();
__property String* get_Text();
};
I was basically missing the "public public", which leads me to my next
question: What in the heck does "public public" mean. Its doubly public. is
"public public public" even more public? ;-)
seriouslyl though...what is the double public thing for?
"john conwell" wrote: 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* get_Subject(); };
and the class that inherits from it is defined like so:
public __gc class Message : public MsgObject, public ITask {
and the get_Subject property in the header file for Message looks like so:
__property String* get_Subject();
but no matter what i try, i cant get it to compile. I've played with every combination of __gc, interface, __interface, public or not and no luck.
mostly i get a compile error stating that my Message class can only inherit from one base class. but i've got the ITask defined as an interface. any ideas?
thanks.
I think your problem is (and I'm having the same problem with my code) is
that MANAGED code doesn't allow MULTIPLE-inheritance.
So:
public __gc class Message : public MsgObject, public ITask ...
just won't work... (sorry, I wish it did, would save me lots of extra work
too...hehe)
"john conwell" <jo*********@di scussions.micro soft.com> wrote in message
news:B7******** *************** ***********@mic rosoft.com... ok...so i figured out i was miss-defining my interface. the following works just fine:
public __gc __interface ITask { public public: __property String* get_Subject(); __property String* get_Text(); };
I was basically missing the "public public", which leads me to my next question: What in the heck does "public public" mean. Its doubly public. is "public public public" even more public? ;-)
seriouslyl though...what is the double public thing for? "john conwell" wrote:
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* get_Subject(); };
and the class that inherits from it is defined like so:
public __gc class Message : public MsgObject, public ITask {
and the get_Subject property in the header file for Message looks like so:
__property String* get_Subject();
but no matter what i try, i cant get it to compile. I've played with every combination of __gc, interface, __interface, public or not and no luck.
mostly i get a compile error stating that my Message class can only inherit from one base class. but i've got the ITask defined as an interface. any ideas?
thanks.
It doesnt allow multiple class inheritance, but you can inherit from as many
interfaces as you want. I figured out the problem, i just cant find any info
on what "public public" is for in the interface definition
"Peter Oliphant" wrote: I think your problem is (and I'm having the same problem with my code) is that MANAGED code doesn't allow MULTIPLE-inheritance.
So:
public __gc class Message : public MsgObject, public ITask ...
just won't work... (sorry, I wish it did, would save me lots of extra work too...hehe)
"john conwell" <jo*********@di scussions.micro soft.com> wrote in message news:B7******** *************** ***********@mic rosoft.com... ok...so i figured out i was miss-defining my interface. the following works just fine:
public __gc __interface ITask { public public: __property String* get_Subject(); __property String* get_Text(); };
I was basically missing the "public public", which leads me to my next question: What in the heck does "public public" mean. Its doubly public. is "public public public" even more public? ;-)
seriouslyl though...what is the double public thing for? "john conwell" wrote:
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* get_Subject(); };
and the class that inherits from it is defined like so:
public __gc class Message : public MsgObject, public ITask {
and the get_Subject property in the header file for Message looks like so:
__property String* get_Subject();
but no matter what i try, i cant get it to compile. I've played with every combination of __gc, interface, __interface, public or not and no luck.
mostly i get a compile error stating that my Message class can only inherit from one base class. but i've got the ITask defined as an interface. any ideas?
thanks.
john conwell wrote: ok...so i figured out i was miss-defining my interface. the following works just fine:
public __gc __interface ITask { public public: __property String* get_Subject(); __property String* get_Text(); };
I was basically missing the "public public", which leads me to my next question: What in the heck does "public public" mean. Its doubly public. is "public public public" even more public? ;-)
seriouslyl though...what is the double public thing for? "john conwell" wrote:
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* get_Subject(); };
and the class that inherits from it is defined like so:
public __gc class Message : public MsgObject, public ITask {
and the get_Subject property in the header file for Message looks like so:
__property String* get_Subject();
but no matter what i try, i cant get it to compile. I've played with every combination of __gc, interface, __interface, public or not and no luck.
mostly i get a compile error stating that my Message class can only inherit from one base class. but i've got the ITask defined as an interface. any ideas?
thanks.
It should work with just one "public" there.
public public:
is a synonym for
public:
If you use 2 then the most restrictive one is for access outside the
assembly and the least restrictive one is for access inside the assembly.
E.g.
public private:
Means that any class in the assembly can access the members defiend
after this but no class outside of the assembly can.
Ronald
Eurika!!!
thanks dude
"Ronald Laeremans [MSFT]" wrote: john conwell wrote: ok...so i figured out i was miss-defining my interface. the following works just fine:
public __gc __interface ITask { public public: __property String* get_Subject(); __property String* get_Text(); };
I was basically missing the "public public", which leads me to my next question: What in the heck does "public public" mean. Its doubly public. is "public public public" even more public? ;-)
seriouslyl though...what is the double public thing for? "john conwell" wrote:
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* get_Subject(); };
and the class that inherits from it is defined like so:
public __gc class Message : public MsgObject, public ITask {
and the get_Subject property in the header file for Message looks like so:
__property String* get_Subject();
but no matter what i try, i cant get it to compile. I've played with every combination of __gc, interface, __interface, public or not and no luck.
mostly i get a compile error stating that my Message class can only inherit from one base class. but i've got the ITask defined as an interface. any ideas?
thanks. It should work with just one "public" there.
public public: is a synonym for public:
If you use 2 then the most restrictive one is for access outside the assembly and the least restrictive one is for access inside the assembly.
E.g.
public private:
Means that any class in the assembly can access the members defiend after this but no class outside of the assembly can.
Ronald This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Sai Kit Tong |
last post by:
I posted for help on legacy code interface 2 days ago. Probably I didn't
make it clear in my original mail. I got a couple of answers but none of
them address my issues directly (See attached response). My first reply
directed me to source code migration but I didn't have the source code. The
second reply mentioned about .NET interoperability (PInvoke I think) but I
MENTIONED THAT I COULDN'T FIND ANY DOCUMENTATION FROM MSDN LIBRARY BASED ON...
|
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) .
|
by: Brett Hall |
last post by:
I have a VB.NET interface that my managed C++ code is to implement. I
seem to
be stuck implementing an event defined in that interface. Does anyone
have a
simple code snippet that will show me the basics of what I need to
implement?
I've seen all the MSDN articles on implementing events in managed C++
and
I've gotten events to work without issue when implementing all the
constructs
|
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 says:
usage: java fit.FitServer host port socketTicket
-v verbose
I think this is because I do not understand the jython mechanism for
inheritance (yet).
|
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 : IMyInterface1 => OK
public class MyClass2 : IMyInterface1, IMyInterface2 => Error
Regards
/Niklas
| |
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 MovePoint(double,double);
}
}
|
by: zzw8206262001 |
last post by:
Hi,I find a way to make javescript more like c++ or pyhon
There is the sample code:
function Father(self) //every contructor may have "self"
argument
{
self=self?self:this; //every class may have this statement
self.hello = function()
{
|
by: =?Utf-8?B?QmFqaS4=?= |
last post by:
Hi,
Can somebody suggest me, how can I implement a vc++ interface in C#.net.
This interface has method CallMe( ) which is used as a CallBack from my main
application.
Thanks,
Baji.
|
by: ttc |
last post by:
Hi All,
I have a managed class that inherits from an unmanged class. The question
is, if the object of the manged class get garbage collected, will the memory
be free automatically for me or only the bit that is used by the managed
code? What about the unmanaged bit?
Does anyone know of any article that discuss about this?
Any help is appreciated.
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |