From: Jean-Pierre D. <jea...@tr...> - 2003-10-14 01:28:13
|
Jim, In fact you used the technique yourself in "EXAMPLE - Get Obj Info From R= ef.vi" and that made me post the message about "Class Downcast to Self.vi". This VI should indeed check if the object is valid = and return an error for invalid object even if the class downcast succeeds. Jean-Pierre ----- Message d'origine -----=20 De : "Jim Kring" <ji...@ji...> =C0 : <ope...@li...> Envoy=E9 : 13 octobre, 2003 20:28 Objet : [opengoop] "Variant To Data" downcasts Class Type Inheritance Ref= nums > Based on Jean-Pierre's comments about using "Variant to Data" for downc= asting > an inheritable data structure, I realized that "Variant to Data" can be= used > for downcasting Class Type Inheritance Refnums (analagous to "To More > Specific Class" fuction). It will even output an error at run-time (Er= ror > 91, "The data type of the variant is not compatible with the data type = wired > to the type input."), if the class information in the variant does not = match > the more specific type. For example, this prevents one from trying to > Downcast to a class from the classes uncle (Car =3D=3D> DeLorian is OK,= but Truck > =3D=3D> Delorian produces an ERROR). Adopting this technique means tha= t a class > does not have to provide a polymorphic VI for downcasting to each desce= ndant > type. The only downside, is that this method does not rely on the obje= ct > reference to check if the object is really of the more specific type. > However, this check will have to be done in any downstream VI that oper= ates > on the more specific type. > > -Jim > > > ------------------------------------------------------- > This SF.net email is sponsored by: SF.net Giveback Program. > SourceForge.net hosts over 70,000 Open Source Projects. > See the people who have HELPED US provide better services: > Click here: http://sourceforge.net/supporters.php > _______________________________________________ > OpenGToolkit-Developers mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/opengtoolkit-developers |