well seems like the number of problems i encounter never ends...
I have a vector with nodes (each node contains several items, say x,y,z). I am trying to read the values in each node, and I can't succeed (it compiles and links, but the output is 1 all the time). Here's what I did:
Code:class block_class { public: block_class(); block_class( etc...); int get_x() { return x;}; int get_y() { return y;}; int get_z() { return z;}; etc... private: int x,y,z; }and now I want to do something like list[0].get_x or list.at[0].get_x and I can't. So what I did was:Code:// the driver function vector<block_class> list; block_class A; ...fill in block A (assign values to x,y,z) and do list.push_back(A)... ...fill in block A again with different values and do list.push_back(A)... ...do the above for a few times until the list vector is populated with block_classes...
which keeps returning "1"Code:block_class X = list[0]; cout<<X.get_x;
Please advise.



LinkBack URL
About LinkBacks


