I am trying to create a class that, when instantiated in to an object, will place a number of randomly generated elements in to a vector. Right off the bat, the Visual Studio editor thinks that my declared vector variable is actually a function. When I hover over "listOfNums", I get this error:
"std::vector<int> SortedArray::listOfNums(size_t numOfElements)
Function definition for 'listOfNums' not found."
Shouldn't the C++ compiler recognize that "listOfNums" is using a constructor to take size "numOfElements"?
Here is my code:
1 2 3 4
class SortedArray{
private:
std::vector<int> listOfNums(size_t numOfElements);
}