I am working on an array of classes so I can store some information that will be used later into my program. This is what I have for my array.
Car carArray[] = {Car ("Porsche", "911", "Silver", 2005, 50000),
Car ("Ford", "Mustang", "Red", 2007, 25000),
Car ("Voltzwagon", "Jetta", "Black", 2006, 16500)};
-- This is how I am calling it to check the information
cout << "Testing this array: " << carArray[0].getMake()
.getModel()
.getColor().getYear()
.getordervalue();
(had to split it up to make it show, or it would cut part of this line up.)
If I run it with just one of the .get, it will work. But once I add more than one, I get errors such as this.
'getModel' : is not a member of 'basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
left of '.getColor' must have class/struct/union type
left of '.getYear' must have class/struct/union type
left of '.getordervalue' must have class/struct/union type
Car carArray[] = {Car ("Porsche", "911", "Silver", 2005, 50000),
Car ("Ford", "Mustang", "Red", 2007, 25000),
Car ("Voltzwagon", "Jetta", "Black", 2006, 16500)};
-- This is how I am calling it to check the information
cout << "Testing this array: " << carArray[0].getMake()
.getModel()
.getColor().getYear()
.getordervalue();
(had to split it up to make it show, or it would cut part of this line up.)
If I run it with just one of the .get, it will work. But once I add more than one, I get errors such as this.
'getModel' : is not a member of 'basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
left of '.getColor' must have class/struct/union type
left of '.getYear' must have class/struct/union type
left of '.getordervalue' must have class/struct/union type