Exforsys

Online Training

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 ...


Go Back   Exforsys > Programming Talk > C and C++

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-21-2007, 04:39 PM
Junior Member
 
Join Date: Jul 2007
Posts: 1
mario-kl is on a distinguished road
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 10-20-2008, 04:16 PM
Member
 
Join Date: May 2006
Posts: 45
norman is on a distinguished road
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 10-20-2008, 05:23 PM
Junior Member
 
Join Date: Jul 2007
Posts: 1
mario-kl is on a distinguished road
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!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit Tech FAQ 0 06-01-2004 07:00 AM
comp.cad.autocad AutoLISP FAQ (part 2/2) - samples, code Reini Urban Tech FAQ 0 06-01-2004 06:30 AM
comp.cad.autocad AutoLISP FAQ (part 1/2) - general Reini Urban Tech FAQ 0 06-01-2004 06:30 AM
Robot Competition FAQ for June 2004 R. Steven Rainwater Tech FAQ 0 05-27-2004 09:59 PM
comp.cad.autocad AutoLISP FAQ (part 2/2) - samples, code Reini Urban Tech FAQ 0 05-01-2004 06:30 AM


All times are GMT -4. The time now is 05:39 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2004 - 2007 Exforsys Inc. All rights reserved.