[Stk] newbie question
Josep M Comajuncosas
josep.comajuncosas@wanadoo.es
Sat, 24 Mar 2007 18:20:37 +0100
Thanks all, I thought it had to be a java-style syntax. Everything is fine
now.
Many thanks to all to help me in such a trivial question,
Josep M
-----Missatge original-----
De: stk-admin@ccrma.Stanford.EDU [mailto:stk-admin@ccrma.Stanford.EDU] En
nom de Perry R Cook
Enviat: sábado, 24 de marzo de 2007 17:45
Per a: Michael Chinen
a/c: Josep M Comajuncosas; stk@ccrma.Stanford.EDU
Tema: Re: [Stk] newbie question
Josep,
Michael is right on.
You need to use the pointer form if you want to call a constructor that
takes arguments. A class may have more than one constructor, a default
without arguments, which is automagically called when you declare an
instance of it, and others which might take arguments.
PRC
On Sun, 25 Mar 2007, Michael Chinen wrote:
> 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@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
>
> _______________________________________________
> Stk mailing list
> Stk@ccrma.stanford.edu
> http://ccrma-mail.stanford.edu/mailman/listinfo/stk
>
_______________________________________________
Stk mailing list
Stk@ccrma.stanford.edu
http://ccrma-mail.stanford.edu/mailman/listinfo/stk