Runtime Type Information

RTTI is an abbreviation for Runtime Type Information ( " type information at runtime " ) and is a term used in software development and a constituent of various programming languages.

RTTI allows you to determine the type of an object at runtime. Thus, a program can determine during its execution, which concrete class an object belongs to which shows a certain reference. Without this mechanism, " knew " the program at this point only that a copy of any class is referenced, which is derived from the base class. With this mechanism, it "knows" which class belongs to the referenced object.

While RTTI is a fairly simple mechanism, which usually provides only the name of the concrete class, there are in more modern programming languages, the mechanism of reflection, which makes it possible to determine information about other properties of a class at runtime, such as the names and signatures of its methods.

Example

So be eg a reference to a copy of the base class " business partner " given by the two concrete subclasses "customer" and "supplier" are defined. With type information at run time, the program can find out if a certain business partner is a customer or a supplier.

Special

  • In Java, the type information is provided at runtime by the method " getClass ", which returns a reference to a so-called class object that knows among other things, the name of the concrete class.
  • In Object Pascal is one of the is operator is available. Also, you can Class Info, Class Type and class name of an object to query.
  • Data type
697400
de