There’s no such thing as a member function of a raw array.
The sub-expression detectionMethods
refers to the raw array and decays to a pointer to the first item. The rest, ->length()
, calls a member function of the first item.
One easy way to avoid these problems is to use std::vector
instead of a raw array. Your book should be recommending that.
solved Why is size() function of std::string[] array returning an incorrect number of parameters [closed]