The rules are the same as the ones you already quoted (assign to same type or superclass type, or appropriate interface class type), but applied to the type of the actual object determined at runtime instead of the type of the handle variable determined at compile time. From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of Shalom Bresticker Sent: Sunday, December 13, 2015 6:39 AM To: sv-ec@eda.org Subject: [sv-ec] casting between class handles 8.16 (Casting) says, "It is always legal to assign an expression of subclass type to a variable of a class type higher in the inheritance tree (a superclass or ancestor of the expression type). It shall be illegal to directly assign avariable of a superclass type to a variable of one of its subclass types. However, $cast may be used to assign a superclass handle to a variable of a subclass type provided the superclass handle refers to an object that is assignment compatible with the subclass variable." Similarly, it says below, "When $cast is applied to class handles, it succeeds in only three cases: ... 2) The type of the source expression is cast compatible with the destination type, that is, either: - the type of the source expression is a superclass of the destination type, or ... and the source is an object that is assignment compatible with the destination type." Question: where is the definition of assignment compatibility between class objects? Thanks, ShalomReceived on Sun Dec 13 14:42:32 2015
This archive was generated by hypermail 2.1.8 : Sun Dec 13 2015 - 14:42:38 PST