I have declared std::vector<Training> _classes;
in Training.h
as a private variable. I want to first get _noOfClasses
from the user and then initialise the vector
with that many elements, but I am getting an error:
call of an object of a class type without appropriate operator() or conversion functions to pointer-to-function type
Training::Training() : _noOfClasses(0) {
std::cout << "Enter the number of class\n";
std::cin >> _noOfClasses;
_classes(_noOfClasses); //Error
}
How do I initialize the size of the vector
from user input, separately?