internal static HandleRef getCPtr(Child obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
 public static Parent InstantiateConcreteObject(IntPtr cPtr, bool owner)
 {
     Parent ret = null;
     if (cPtr == IntPtr.Zero)
     {
       return ret;
     }
     int type = CppApiPINVOKE.Parent_WhatAmI(new HandleRef(null, cPtr));
     switch (type)
     {
        case 0:
      ret = new Parent(cPtr, owner);
      break;
        case 1:
      ret = new Child(cPtr, owner);
      break;
       // Repeat for every other concrete type.
       default:
     System.Diagnostics.Debug.Assert(false,
     String.Format("Encountered type '{0}' that is not any known concrete class",
     type.ToString()));
     break;
     }
     return ret;
 }