= !SubclassIdentifier = [[TracNav(TracNav/TOC_Documentation)]] == Description == The [wiki:SubclassIdentifier] acts like an [wiki:Identifier]. You can assign a [wiki:ClassIdentifier] and compare it with other [wiki:Identifier Identifiers] by using isA(...), isChildOf(...) and other functions. [wiki:SubclassIdentifier] is a [wiki:template]. The [wiki:template]-class defines the needed base-class of an assigned Identifier. You can only assign [wiki:Identifier Identifiers] representing a class which is derived from the given base-class (or the base-class itself). If you try to assign an Identifier that's not derived from the base-class, you get an error. Usage: !SubclassIdentifier name = Class(!SubClass); where !SubClass isA !BaseClass. == Examples == The following examples use the class-tree below. {{{ #!cpp SubclassIdentifier myidentifier = Class(A1); // This works SubclassIdentifier myidentifier = Class(A1B1); // This works SubclassIdentifier myidentifier = Class(A1B1C1); // This works SubclassIdentifier myidentifier = Class(BaseObject); // This doesn't work SubclassIdentifier myidentifier = Class(A3); // This doesn't work SubclassIdentifier myidentifier = Class(A3); // This works SubclassIdentifier myidentifier = Class(A2B2C1); // This works SubclassIdentifier myidentifier = Class(A1B1); myidentifier.isExactlyA(Class(A1)); // Returns false myidentifier.isExactlyA(Class(A1B1)); // Returns true (*myidentifier)->getName(); // Returns "A1B1" myidentifier->getName(); // Returns "A1B1" (Yes, the "->" is correct. It's overloaded.) A1* newobject = myidentifier.fabricate(); // Returns a new instance of A1B1, downcasted to A1 }}} [[Image(Core:testclass_interface_tree.gif)]]