What does \'&\' mean in C++?
As within the function
void Read_wav::read_wav(const string &filename)
{
}
And what is its equiv
References are aliases, they are very similar to pointers.
std::string
is an array of char
with an explicit length
(that is, there can be null characters embedded within).
There is a C-library to emulate std::string
(that is, provide an encapsulated interface) called bstring
for Better String Library. It relieves you from the tedium of having to deal with two distinct variables (array and length).
You cannot use classes in C
, but you can emulate them with forwarded struct (to impose encapsulation) and class methods simply become regular functions with an explicit parameter.
Altogether, this leads to the following transformation:
void Read_wav::read_wav(const string &filename);
void read_wav(struct Read_wav* this, struct bstring const* filename);
Which (apart from the struct
noise) is very similar to what you had before :)