[flext] Overriding inherited methods?

Jamie Bullock jamie at jamiebullock.com
Tue Dec 10 20:38:16 UTC 2013


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/78ccbeb4/attachment.html>


More information about the flext mailing list