nanode
03-21-2001, 02:08 PM
I'm a lazy Java coder and I'm stuck with a likely simple problem.
I have 2 functions:
Function A creates an instance of a Collection class and passes a ref. of that Collection to Function B.
Function B needs to add elements to said Collection, but my compiler isn't allowing that, since I only have a pointer to the Collection.
void functionA() {
Collection c;
functionB(&c);
}
void functionB(Collection * cref) {
cref.add(xxx);
}
Am I doing this completely wrong?
I have 2 functions:
Function A creates an instance of a Collection class and passes a ref. of that Collection to Function B.
Function B needs to add elements to said Collection, but my compiler isn't allowing that, since I only have a pointer to the Collection.
void functionA() {
Collection c;
functionB(&c);
}
void functionB(Collection * cref) {
cref.add(xxx);
}
Am I doing this completely wrong?