Highlighted

Incorrect value of object if using type casting

Community Beginner ,
Jun 02, 2015

Copy link to clipboard

Copied

Run code:

var sqlError:SQLError = new SQLError("test", "", "", 7);

trace("sqlError.errorID: " + sqlError.errorID);

trace("Error(sqlError).errorID: " + Error(sqlError).errorID);

trace("(sqlError as Error).errorID: " + (sqlError as Error).errorID);

Actual Result:

[trace] sqlError.errorID: 7

[trace] Error(sqlError).errorID: 0

[trace] (sqlError as Error).errorID: 7

Expected Result:

[trace] sqlError.errorID: 7

[trace] Error(sqlError).errorID: 7

[trace] (sqlError as Error).errorID: 7


Is it a runtime bug or "feature"?

TOPICS
Performance issues

Views

142

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Incorrect value of object if using type casting

Community Beginner ,
Jun 02, 2015

Copy link to clipboard

Copied

Run code:

var sqlError:SQLError = new SQLError("test", "", "", 7);

trace("sqlError.errorID: " + sqlError.errorID);

trace("Error(sqlError).errorID: " + Error(sqlError).errorID);

trace("(sqlError as Error).errorID: " + (sqlError as Error).errorID);

Actual Result:

[trace] sqlError.errorID: 7

[trace] Error(sqlError).errorID: 0

[trace] (sqlError as Error).errorID: 7

Expected Result:

[trace] sqlError.errorID: 7

[trace] Error(sqlError).errorID: 7

[trace] (sqlError as Error).errorID: 7


Is it a runtime bug or "feature"?

TOPICS
Performance issues

Views

143

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jun 02, 2015 1
Community Beginner ,
Jun 02, 2015

Copy link to clipboard

Copied

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 02, 2015 0