473,473 Members | 2,185 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

__property set_ naming issue (managed C++)

What would you expect from the following:

enum Type { a, b, c };

public __gc class MClass
{
public:
MClass(Type t);
__property void set_Type(Type t);
// etc.
};

When compiling, I get very strange errors (in this case, for the constructor)
where the Type type is compiled as the managed Type property. It is an easy
fix, although the compiler diagnostic is far from intuitive.

Comments?
Nov 17 '05 #1
3 1337
Hi Julie,
What would you expect from the following:

enum Type { a, b, c };

public __gc class MClass
{
public:
MClass(Type t);
__property void set_Type(Type t);
// etc.
};

When compiling, I get very strange errors (in this case, for the constructor) where the Type type is compiled as the managed Type property. It is an easy fix, although the compiler diagnostic is far from intuitive.

Comments?


What errors are you getting? Compiling your sample code, I get:
t.cpp
t.cpp(9) : error C2872: 'Type' : ambiguous symbol
could be 't.cpp(4) : Type'
or 't.cpp(1) : System::Type'
t.cpp(10) : error C2872: 'Type' : ambiguous symbol
could be 't.cpp(4) : Type'
or 't.cpp(1) : System::Type'

which actually seems like a very good diagnostic message.

--
Tomas Restrepo
to****@mvps.org
Nov 17 '05 #2
"Tomas Restrepo (MVP)" wrote:

Hi Julie,
What would you expect from the following:

enum Type { a, b, c };

public __gc class MClass
{
public:
MClass(Type t);
__property void set_Type(Type t);
// etc.
};

When compiling, I get very strange errors (in this case, for the

constructor)
where the Type type is compiled as the managed Type property. It is an

easy
fix, although the compiler diagnostic is far from intuitive.

Comments?


What errors are you getting? Compiling your sample code, I get:
t.cpp
t.cpp(9) : error C2872: 'Type' : ambiguous symbol
could be 't.cpp(4) : Type'
or 't.cpp(1) : System::Type'
t.cpp(10) : error C2872: 'Type' : ambiguous symbol
could be 't.cpp(4) : Type'
or 't.cpp(1) : System::Type'

which actually seems like a very good diagnostic message.

My mistake --

Type should be MyType in all instances.
Nov 17 '05 #3
Hi Julie,

My mistake --

Type should be MyType in all instances.


Meaning this, then?

#using <mscorlib.dll>
using namespace System;

enum MyType { a, b, c };

public __gc class MClass
{
public:
MClass(MyType t);
__property void set_Type(MyType t);
// etc.
};

Compiles fine for me :|

--
Tomas Restrepo
to****@mvps.org
Nov 17 '05 #4

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

Similar topics

0
by: Moshe Plotkin | last post by:
B"H Sometimes when I import a COM Object written in VB with public Variables it requires me to use the get_ set_ functions instead of alowing me to use them ans Propeties. An suggestions? ...
7
by: | last post by:
Borland dumped all its "Borand C++ Builder" (BCB) customers. So it is our term to dump Borland (not only BCB). As a part of my attempt to dump long-loved BCB I'm trying to investigate how one can ...
0
by: Edward Diener | last post by:
Since a __property can be split between a read access and a write access property in MC++, how does one set an attribute on a __property ? Is setting an attribute before either the read access...
6
by: | last post by:
With the below example (taken from MSDN).. This also makes visible the set_Size and get_Size methods, and generates the Size property as we normally see it. Why didnt the get_ and set_...
4
by: | last post by:
Hi, If I make a __gc type with __property set and get I set them to private:, those 2 methods are private ok but the actual generated property is public according to the object browser yet its...
0
by: Carl | last post by:
I started using managed C++ properties the standard way. E.g. __property void set_Value (Double Value) { m_Value=Value; } __property bool set_Value (Double Value) { if ( Value < 0 ) return...
9
by: Christian Kaiser | last post by:
Hmmm. I just got the following compiler messages: test_cpp.cpp d:\src\logsolar\datasources\test_cpp\test_cpp.h(18) : error C3760: please use __property keyword to declare property in managed...
8
by: mrashidsaleem | last post by:
Can anyone guide me what is wrong with the naming conventions suggested below? I know that this is not recommended by many (including Microsoft) but I need to know what exactly is the rationale...
5
by: Monty | last post by:
I have an ASP.Net project I developed in VS2003 (ASP.Net 1.1) that works fine, but when I convert it to VS2005 (ASP.Net 2.0) it's behavior seems to change. I have the following datagrid in my...
0
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...
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
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...
1
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,...
1
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
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
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
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.