vector with class?

im trying to display the string using vector but always got problems.. pls help?

error is : error C2040: 'properties' : 'std::string []' differs in levels of indirection from 'std::vector<_Ty>


int x=4;

vector < Property* > properties(x);

string properties[] = {"123,#12-11 Ah Hood Road","45 China Street","234,#19-18 Bombay Street","56 Hinot Road"};

Apartment a("Peter Tan",9712345,properties,3000,4);

cout<<a.getPropertyDetails()<<endl;

Landed b("Shuan How",9876542,properties,4000,3);

cout<<b.getPropertyDetails()<<endl;

Apartment c("Cindy Ng",9812345,properties,2800,5);

cout<<c.getPropertyDetails()<<endl;

Property d("Rebecca Choy",9876543,properties,5490);

cout<<d.getPropertyDetails()<<endl;

You have a container and an object with the same name:
vector<Property*> properties(x) and string properties[].
Last edited on
Topic archived. No new replies allowed.