[flext] Overriding inherited methods?

Jamie Bullock jamie at jamiebullock.com
Tue Dec 10 20:46:14 UTC 2013


Answering my own question, it was a typo in my code: I omitted the 'virtual' keyword for the to-be-overridden methods in the base class.

Sorry for the noise!

Jamie

On 10 Dec 2013, at 20:38, Jamie Bullock <jamie at jamiebullock.com> wrote:

> 
> Hi,
> 
> Is it possible to override inherited methods with Flext?
> 
> For example, if I have a "library" and I have a base class with something like:
> 
> class Base:
> public flext_base
> {
> 
> protected:
> 	static void setup(t_classid c)
> 	{
> 		FLEXT_CADDMETHOD_(c, 0, "foo", foo);
> 	}
> 	void foo(int argc, const t_atom *argv)
> 	{
> 		// do something
> 	}
> 
> private:
> 	FLEXT_CALLBACK_V(foo);
> }
> 
> 
> And then a child class like:
> 
> class Child : Base
> {
> 	FLEXT_HEADER_S(Child, Base, setup);
> 
> protected:
> 	void foo(int argc, const t_atom *argv)
> 	{
> 		// do something different
> 
> 	} 
> }
> 
> The foo() in the base class always gets called even for an instance of the "Base" object in Pd. I've tried adding FLEXT_CADDMETHOD_() and FLEXT_CALLBACK_V() for the child class, but that doesn't seem to work either. Is what I'm trying to do possible?
> 
> The use case is that I want some common functionality in the base class, which is implemented differently by some of the objects in the library.
> 
> Thanks,
> 
> Jamie
> 
> 
> 
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://grrrr.org/pipermail/flext/attachments/20131210/89d25a5a/attachment.html>


More information about the flext mailing list