Topic: Polymorphism/Dynamic-Binding in C++/SmallTalk


Author: mmediko@hubcap.clemson.edu (Medikonda Muralidhar)
Date: 16 Mar 1994 23:06:20 GMT
Raw View
 Hello:
 I had a basic question on issues regarding polymorphism and dynamic
 binding in C++/Smalltalk:
 How exactly is polymorphism/dynamic binding resolved at runtime?
 Suppose I have class B inheriting from class A, and class C inheriting
 from B.  All the three classes have a definition of a method, say x().

 I create an instance variable
 A * aa; // in C++

 and then use it to send a message to x()

  aa->xx();

  at runtime, how is it resolved based on the type? Is type of aa first
  checked with the type of A, and then B, and then C?? or is it done in
  any other way, like having a table or whatever? I need information
  regarding the actual design of runtime resolution.

  Please reply to anandk@cs.clemson.edu. Your help is greatly
  appreciated.

  Thank you,
   Anand
---------------------------------------------------------------------