-1

I am following this tutorial on audio programming in C++ an theres is something I do not understand; what does the fourth line suppose to represent? I understand I am not creating an instance of AudioObject because I do not instantiate it with the new keyword. However why can assign attributes to it? This closely resembles a function declaration which gets me confused as sound is a used as reference elsewhere in my main. e.g

SampleInfo info; //struct
info.volume = 1.0;

AudioObject sound(info, data); //<--this line


//why can assign info, data
Ðаn
  • 10,934
  • 11
  • 59
  • 95

1 Answers1

0

You are in fact creating an instance of an AudioObject with automatic storage duration , but not a dynamically allocated instance (via new). info and data are the arguments you pass to the constructor. Avoid using new except when you really need it, C++ is not Java.

vsoftco
  • 55,410
  • 12
  • 139
  • 252