//-----------------------------------------------------------------------------
// Just inherit, no methods, no constructor/destructor
QoreClass* initBuiltinInheritanceTestDescendant1(QoreClass* base)
{
  QoreClass* tst = new QoreClass("BuiltinInheritanceTestDescendant1", QDOM_PROCESS);
  CID_BUILTININHERITANCETESTDESCENDANT1 = tst->getID();
  tst->addDefaultBuiltinBaseClass(base);

  return tst;
}
//-----------------------------------------------------------------------------
QoreClass* initBuiltinInheritanceTestBaseClass()
{
  QoreClass* tst = new QoreClass("BuiltinInheritanceTestBase", QDOM_PROCESS);
  CID_BUILTININHERITANCETESTBASE = tst->getID();

  tst->setConstructor((q_constructor_t)BUILTININHERITANCETESTBASE_constructor);
  tst->setDestructor((q_destructor_t)BUILTININHERITANCETESTBASE_destructor);
  tst->addMethod("getnum", (q_method_t)BUILTININHERITANCETESTBASE_getnum);
  return tst;
}
//-----------------------------------------------------------------------------
// override getnum()
QoreClass* initBuiltinInheritanceTestDescendant4(QoreClass* base)
{
  QoreClass* tst = new QoreClass("BuiltinInheritanceTestDescendant4", QDOM_PROCESS);
  CID_BUILTININHERITANCETESTDESCENDANT4 = tst->getID();
  tst->addDefaultBuiltinBaseClass(base);

  tst->addMethod("getnum", (q_method_t)BUILTININHERITANCETESTDESCENDANT4_getnum);

  return tst;
}
//-----------------------------------------------------------------------------
// override constructor, destructor, getnum()
QoreClass* initBuiltinInheritanceTestDescendant2(QoreClass* base)
{
  QoreClass* tst = new QoreClass("BuiltinInheritanceTestDescendant2", QDOM_PROCESS);
  CID_BUILTININHERITANCETESTDESCENDANT2 = tst->getID();
  tst->addDefaultBuiltinBaseClass(base);

  tst->setConstructor((q_constructor_t)BUILTININHERITANCETESTDESCENDANT2_constructor);
  tst->setDestructor((q_destructor_t)BUILTININHERITANCETESTDESCENDANT2_destructor);
  tst->addMethod("getnum", (q_method_t)BUILTININHERITANCETESTDESCENDANT2_getnum);

  return tst;
}
void QoreSmokeBinding::deleted(Smoke::Index classId, void *obj)
{
     assert(obj);

     QoreClass *qc;
     QoreObject *o = getQoreObject(classId, obj, qc);

     //printd(5, "QoreSmokeBinding::deleted() %s::~%s qobject=%p qore obj=%p\n", className(classId), className(classId), obj, o);

     if (o) {
          ExceptionSink xsink;

          // mark private data as cleared
          PrivateDataRefHolder<QoreSmokePrivate> qsd(o, qc->getID(), &xsink);
//         printd(0, "QoreSmokeBinding::deleted() external delete Qore class %s (Qt class %s) (qsd=%p)\n", o->getClassName(), className(classId), *qsd);

          if (qsd)
               qsd->externalDelete(o, &xsink);
          else
               // mark qore object as externally deleted
               o->externalDelete(qc->getID(), &xsink);
     }
}
//-----------------------------------------------------------------------------
QoreClass* initBuiltinInheritanceTestDescendantMulti(QoreClass* base, QoreClass* base2)
{
  QoreClass* tst = new QoreClass("BuiltinInheritanceTestDescendantMulti", QDOM_PROCESS);
  CID_BUILTININHERITANCETESTDESCENDANT_MULTI = tst->getID();

  // we have a method (getnum) below, but no constructor to set our own private data,
  // therefore we have to call addDefaultBuiltinBaseClass() on one of the base classes
  // to have some private data...
  //tst->addBuiltinBaseClass(base);
  tst->addBuiltinBaseClass(base2);

  // OTOH simple inheritance works
  tst->addDefaultBuiltinBaseClass(base);

  tst->addMethod("getnum", (q_method_t)BUILTININHERITANCETESTDESCENDANT_MULTI_getnum);
  return tst;
}