First time asking a question on Stack Overflow, I'll try my best.
In C++11, can I declare an Array of Objects, and then give them different values in initialization?
My Code looks like this. I thought I could initialize them like I would a struct.
#include <iostream>
#include <string>
#include "personType.h"
int main(){
personType people[3]{{ "Jacob", "Hicks" }, { "Moria", "Brown" }, { "Marty", "Robinson" }};
}
The Constructor in question looks like this
personType(std::string first = "", std::string last = "");
Can I create an array of Objects, and then give them all different values with the constructor? Or do I have to declare three separate instances of the object individually? Or is my syntax just wrong?
