Oct 12, 2011 at 6:25pm UTC
hi can any one please give the procedure how to call function of one .cpp into another .cpp file.
I want the changed values in that .cpp into another cpp file.
i used objects and pointer to call the member functions of class but i ddint get the values changed in one cpp into another.
by using pointer i am getting unhandled exception
Last edited on Oct 13, 2011 at 10:58am UTC
Oct 14, 2011 at 10:47am UTC
Hi hamsterman
Thanks for your reply.
Actually I declared 2 member functions in one class that is in A.cpp.
And i declared B.cpp and i want to use the member functions of class in A.cpp into class of B.ccp
Example:
A.cpp
Class test{
public:
int *a,*b;
assign(int &a,int &b);
};
B.h:
class Area{
int area;
int square();
int rectangle();
};
B.cpp
#include A.cpp
#include B.cpp
class Area::square(){
//here i want to call the assign function
}
Oct 14, 2011 at 12:06pm UTC
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
//A.h
class test{
public :
int *a,*b;
void assign(int &a,int &b);
};
//B.h:
class Area{
int area;
int square();
int rectangle();
};
//B.cpp
#include "A.h"
#include "B.h"
int Area::square(){
Test t;
int a = 5, b;
t.assign(b, a);
}
Last edited on Oct 14, 2011 at 12:06pm UTC