Showing posts with label programming languages. Show all posts
Showing posts with label programming languages. Show all posts

Friday, 16 November 2012

RTTI (Runtime Type Information)

RTTI
RTTI is the abbreviation for runtime type information ("type information at run-time"), a term used in software development and is part of various programming languages​​.

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

While RTTI is a very simple mechanism, which typically provides only the name of the concrete class, there are more modern programming languages ​​in the mechanism of reflection, and it also allows for information about other properties of a class at runtime to determine, for example, the names signatures of its methods.

Example

So be example 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 whether a particular business partner is a customer or a supplier.

Features of RTTI:-

  • In Java, the type information is provided at run-time by using the "getClass" which is a reference to a so-called class object back that knows including the name of the concrete class.
  • Object Pascal is one of the is operator is available. You can also query Class Info, Class Type and Class name of an object.