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

ECMA Doc 8.8.4 Error

When I try to compile the following from the ECMA Docs:

#using <mscorlib.dll>
using namespace System;

public value class point {
int Xor;
int Yor;

public:
property int X {
int get() { return Xor; }
void set(int value) { Xor = value; }
}
property int Y {
int get() { return Yor; }
void set(int value) { Yor = value; }
}

point() {
move(0, 0);
}

point (int x, int y) {
move(x, y);
}

void move(int x, int y) {
X = x; //absolute move
Y = y;
}

void translate(int x, int y) {
X += x;
Y += y;
}
};

int main()
{
point p1;

p1.X = 10;
p1.Y = 5;
p1.move(5, 7);
point p2(9, 1);
p2.translate(-4, 12);
}
I get this error:

8_8_4.cpp(18) : error C3417: 'point::point' : value types cannot contain
user-defined special member functions

Anyone know why?

-Don Kim
Nov 17 '05 #1
2 1181
Special member functions like default constructors, copy constructors and
destructors are not allowed on value classes.
SMF support has been withdrawn. IMO the example was written before the
withdrawal of the default constructor.
Maybe you could report this issue on
http://lab.msdn.microsoft.com/productfeedback

Willy.
"Don Kim" <in**@nospam.donkim.info> wrote in message
news:cP*******************@newssvr29.news.prodigy. com...
When I try to compile the following from the ECMA Docs:

#using <mscorlib.dll>
using namespace System;

public value class point {
int Xor;
int Yor;

public:
property int X {
int get() { return Xor; }
void set(int value) { Xor = value; }
}
property int Y {
int get() { return Yor; }
void set(int value) { Yor = value; }
}

point() {
move(0, 0);
}

point (int x, int y) {
move(x, y);
}

void move(int x, int y) {
X = x; //absolute move
Y = y;
}

void translate(int x, int y) {
X += x;
Y += y;
}
};

int main()
{
point p1;

p1.X = 10;
p1.Y = 5;
p1.move(5, 7);
point p2(9, 1);
p2.translate(-4, 12);
}
I get this error:

8_8_4.cpp(18) : error C3417: 'point::point' : value types cannot contain
user-defined special member functions

Anyone know why?

-Don Kim

Nov 17 '05 #2
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Special member functions like default constructors, copy constructors and
destructors are not allowed on value classes.
SMF support has been withdrawn. IMO the example was written before the
withdrawal of the default constructor.
Maybe you could report this issue on
http://lab.msdn.microsoft.com/productfeedback
You seem correct. I removed the default constructor point(), and the
program compiled. I went ahead and reported to the link above. Thanks.

- Don Kim
"Don Kim" <in**@nospam.donkim.info> wrote in message
news:cP*******************@newssvr29.news.prodigy. com...
When I try to compile the following from the ECMA Docs:

#using <mscorlib.dll>
using namespace System;

public value class point {
int Xor;
int Yor;

public:
property int X {
int get() { return Xor; }
void set(int value) { Xor = value; }
}
property int Y {
int get() { return Yor; }
void set(int value) { Yor = value; }
}

point() {
move(0, 0);
}

point (int x, int y) {
move(x, y);
}

void move(int x, int y) {
X = x; //absolute move
Y = y;
}

void translate(int x, int y) {
X += x;
Y += y;
}
};

int main()
{
point p1;

p1.X = 10;
p1.Y = 5;
p1.move(5, 7);
point p2(9, 1);
p2.translate(-4, 12);
}
I get this error:

8_8_4.cpp(18) : error C3417: 'point::point' : value types cannot contain
user-defined special member functions

Anyone know why?

-Don Kim


Nov 17 '05 #3

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

Similar topics

14
by: John Bentley | last post by:
Note this is crossposted to comp.lang.javacript and microsoft.public.dotnet.scripting. After some Googling and FAQing my understanding of these terms is, crudely: Javascript (3 different...
6
by: Tony Whitter | last post by:
Does anyone know how much changed between the final draft dated October 2002 and the Ecma-334 C# Language Specification 2nd edition dated December 2002 and if there is a change history document...
19
by: anonymouse | last post by:
Is it possible to have C# run in an unmanaged environemnt if somebody should decide to implemnent it this way? Its possible to code C# projects without any dependancy on the libraries at all...
6
by: Alvin Pruney | last post by:
Hi, Since C# is ECMA draft standard, why isn't VB.NET going for standardisation also? Is this because like VB6, it is a closed language and propriarty? VB6 will be ending in a few years...
5
by: Don Kim | last post by:
I copied this example off ECMA C++/CLI draft document, and it doesn't compile: #using <mscorlib.dll> using namespace System; public ref class Stack { public: Stack() { first = nullptr;
8
by: VK | last post by:
I'm a bit confused about ECMAScript docs. Can I legally change it format (say from .pdf to .html or .doc) or publish it on my web-site? ECMA provides a free of charge pdf version here:...
9
by: Edward Diener | last post by:
Are there any differences between the version of C++/CLI as implemented in Visual C++ 2005 and the ECMA-372 C++/CLI Language Specification of December 2005 freely downloaded from ECMA ? Asking...
52
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I convert a Number into a String with exactly 2 decimal places?...
0
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,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
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...
0
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.