mercredi 28 septembre 2016

containment

I have a delay object in my plugin (instantiated from a Delay class).

This delay object should also contain a filter object for the feedback path (derived from a Filter class).

I can do this making a public pointer to the filter in the Delay class:

Code:

// Delay.cpp
#include "Filter.h"

class Delay
{
public:
Delay() { mFilter = new Filter()}; // constr.
Filter* mFilter;
...
}

Then I can access the filter functions in my plugin (main) class by doing:

Code:

mDelay.mFilter->doSomething();
This works (it seems) but is it a bad idea ? (bad coding practice etc.)


containment

Aucun commentaire:

Enregistrer un commentaire