somParentNumResolve - Example Code

// SOM IDL for class A and class B
#include <somobj.h>
module spnrExample {
  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_spnrexample_Source
#include <spnrExample.xih>
#include <stdio.h>

SOM_Scope void SOMLINK spnrExample_Afoo(spnrExample_A *somSelf);
{  printf("1\n"); }

SOM_Scope void SOMLINK spnrExample_Bfoo(spnrExample_B *somSelf);
{ printf("2\n"); }

main()
{
  spnrExample_B  *objPtr = new spnrExample_B;

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

// This prints 1
   ((somTD_spnrExample_A_foo)
/* This method procedure expression cast is necessary */
           somParentNumResolve(
                    ,objPtr->somGetClass()->somGetPClsMtabs(),
                    "1"
                    spnrExample_AClassData.foo) // the foo method token
           ) /* end of method procedure expression */
           (objPtr); /* method arguments */
}


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