Is there anyway to pass an array of classes to a function in c++???
Printable View
Is there anyway to pass an array of classes to a function in c++???
I assume you mean an array of one particular class. If so, then its the same way you pass any other array:
Code:void myfunction(myclass []);
All the solution the others have presented pertain to class objects, not classes. You cannot pass class in C++, only class objects.
You should implement the solutions above.
Kuphryn
Or far better - std::vector passed by reference