[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: DCOP inheritance
From:       Ravikiran Rajagopal <ravi () kde ! org>
Date:       2003-06-19 16:36:03
[Download RAW message or body]

Hello,
  Here is the typical way of implementing a DCOP interface to your existing 
class, say MyClass:

class MyClassInterface : virtual public DCOPObject
{
  k_dcop:
    virtual void f() = 0;
};

class MyClass: public MyBaseClass, public DCOPObject
{
  void f(); // Define it somewhere
};

Remember that you must initialize the DCOPObject explicitly in your 
constructor if MyBaseClass inherits DCOPObject too; this is because virtual 
base classes must be initialized first in the most derived class prior to 
initializing normal base classes in C++ (see Steve Dewhurst's "C++ Gotchas" 
book for an extensive discussion).

MyClass::MyClass(...) : DCOPObject(...), MyBaseClass(...), member(...)
{
  // More construction.
}

You just declare an object of class "MyClass" in your main() function or 
wherever, no need for any stub classes. While your object exists, its DCOP 
interface is available to other programs. You can see it using kdcop. I am 
assuming here that you use the KDE build system and are following the 
guidelines at:
http://developer.kde.org/documentation/tutorials/dot/dcopiface/dcop-interface.html

Regards,
Ravi
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic