Specifications

Sun Services
Java™ Programming Language
Module 6, slide 17 of 43
Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. Sun Services, Revision F
Virtual Method Invocation
Virtual method invocation is performed as follows:
Employee e = new Manager();
e.getDetails();
Compile-time type and runtime type invocations have
the following characteristics:
The method name must be a member of the declared
variable type; in this case Employee has a method
called getDetails.
The method implementation used is based on the
runtime object’s type; in this case the Manager class
has an implementation of the getDetails method.