somClassResolve - Example Code

// SOM IDL for class A and class B
#include <somobj.idl>
module scrExample {
  interface A : SOMObject { void foo(); implementation
{ callstyle=oidl;};};
  interface B : A  {  implementation { foo: override;};};
};

// Example C++ program to implement and test module scrExample
#define SOM_Module_screxample_Source
#include <scrExample.xih>
#include <stdio.h>

SOM_Scope void SOMLINK scrExample_Afoo(scrExample_A *somSelf);
{  printf("1\n");}

SOM_Scope void SOMLINK scrExample_Bfoo(scrExample_B *somSelf);
{ printf("2\n");}

main()
{
  scrExample_B  *objPtr = new scrExample_B;

// This prints 2
objPtr->foo();

// This prints 1
   ((somTD_scrExample_A_foo) /* A necessary method procedure cast */
     somClassResolve(
              ,_scrExample_A, // the A class object
              scrExample_AClassData.foo) // the foo method token
     ) /* end of method procedure expression */
     (objPtr); /* method arguments */

// This prints 2
   ((somTD_scrExample_A_foo) /* A necessary method procedure cast */
     somClassResolve(
              ,_scrExample_B, // the B class object
              scrExample_AClassData.foo) // the foo method token
     ) /* end of method procedure expression */
     (objPtr); /* method arguments */

}


[Back: somClassResolve - Related Information]
[Next: somClassResolve - Topics]