[Stk] newbie question

Michael Chinen mchinen at gmail.com
Sat Mar 24 09:09:49 PDT 2007


Hi Josep,

STK is written for C++, so objects will be allocated when their
variables are declared.

SineWave sine;

will allocate and call the SineWave() constructor for the sine
variable behind the scenes.

You are of thinking of Java or C#, perhaps, where objects are all pointers.
If you want to do newing, you will need to explicitly declare the
variable a pointer, such as

SineWave* sine = new SineWave();
sine->setFrequency(..);

HTH

Michael



On 3/24/07, Josep M Comajuncosas <josep.comajuncosas at wanadoo.es> wrote:
>
>
> Hi,
> just an , I guess, idiomatic question about the Stk library.
> Say I use one of the generator classes
>
> SineWave sine;
> sine.setFrequency(...)
>
> I don't see where is the SineWave instance err..instanced, like
>
> SineWave sine = new SineWave();
>
> as those are not class methods but instance methods. Is the sine constructed
> just by declaring it?
> Am I lost somewhere?
>
> Thanks in advance...
> Josep M




More information about the Stk mailing list