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 1728
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*********@discussions.microsoft.com> wrote in message
news:B7**********************************@microsof t.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*********@discussions.microsoft.com> wrote in message news:B7**********************************@microsof t.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...
|
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...
|
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...
|
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 :...
|
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...
|
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; ...
|
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...
|
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: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |