
- Forum
- Programming Talk
- C and C++
- calling functions nested in classes using objects from oder classes
calling functions nested in classes using objects from oder classes
This is a discussion on calling functions nested in classes using objects from oder classes within the C and C++ forums, part of the Programming Talk category; Hello, I'm new in c++. In my program I've got 2 classes where I defined some functions. Then I defined ...
-
calling functions nested in classes using objects from oder classes
Hello, I'm new in c++.
In my program I've got 2 classes where I defined some functions. Then I defined 2 vector-objects of each class and I tried to call one function from the main():
class class1{
variables1;
int t;
public
int get_t(){return t;};
};
class class2{
variables2;
int r;
class2* c2;
public:
int get_r(){return r;};
void void2(class1* a, class2* b, int m ){
for(int i=0; i<m; i++){
if(a->get_r()< b[i]->get_t()){ // whatever, but I don't change anything;}
}
};
main(){
std::vector<class1*> element1;
std::vector<class2*> element2;
int n;
//I initilize both vectors
for(int i;i<n; i++){
element2[i]->void2(element2[i], element1); //How to call the function??
}
}
I tried everything and I red tutorials and nothing wrks. HELP!!
THX,
mario-kl.
-
mario-kl,
Let us know what is the error or output you got. This would help us to solve your problem quicker. Also let me know in what environment that is operating system you are running this program.
-
Thank you Norman
Hey Norman, it was a long time ago. I didn't even remember that I posted that problem, that finally I solved.

Thanks anyway, because I had the feeling of being invisible
Have fun!
-
Sponsored Ads

Reply With Quote





