On 2012-11-14 02:17, Jonathan Wilkes wrote:
I have three classes: foo, bar, bowFoo has a function: void foo_blah(t_foo *x, t_symbol *s, t_int argc, t_atom *argv) { if(x->x_member == 1) do_something... } Bar and bow both have x->x_member, too, and I want all three to use the same function so I don't have to copy it two more times. Is there a way to do this: void foo_blah(t_pd *x, t_symbol *s, t_int argc, t_atom *argv) { if we can cast x to t_foo, t_bar or t_bow then check if x has x->member equal to 1, and if so then do_something... } which I can call by sending t_foo, t_bar or t_bow as the first arg to that function? It seems like I should be able to do this but I can't figure out all the pointer bs.
Something like (t_foo *)x->member, or ((t_bar *)x)->member? Martin _______________________________________________ Pd-dev mailing list [email protected] http://lists.puredata.info/listinfo/pd-dev
