help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

virtual method inheritance question


From: jinxidoru
Subject: virtual method inheritance question
Date: 31 Jul 2006 09:31:03 -0700
User-agent: G2/0.2

I had an idea for something the other day, but it now appears that it
will not work.  Nevertheless, I thought that I might as well post the
question on the off-chance this is possible.  What I want to do is have
a parent class with a bunch of non-pure virtual methods.  There will be
one method for each of standard signals (SIGINT,SIGHUP,SIGUSR1,...).  I
then want an initialization method (not the constructor) to check which
of these methods have been overridden.  For those methods, my parent
class will declare that method as the signal handler.  This would allow
the child class to simply override the appropriate method and
everything would be appropriately set-up.

My thought was that I would just check the address of the member method
against the value of &TheParentClass::TheVirtualMethod.  But that does
not work because there is apparently no way to access the address of a
virtual method.  I thought about checking the vtable, but I haven't
found any way of accessing the vtable that is in the least bit safe.
If anyone has any ideas, please let me know.  I think this would be a
very cool feature if possible.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]