Need help in calling function
I have this header file
Code:
#ifndef DRAWTRACK_H
#define DRAWTRACK_H
class VectorDraw
{
private:
int x , y ;
public:
void FastRect();
};
#endif
And I have a function delaration in another file
Code:
#include <iostream.h>
#include "drawtrack.h"
void VectorDraw::FastRect()
{
cout<<"some random code here";
}
I want to call this function from another file .
Can someone tell me the syntax
Re: Need help in calling function
How did you get this far without knowing how to call a member function? I'm not sure I quite understand why you wouldn't know, but all you have to do is #include the header file (drawtrack.h), create a VectorDraw object and call the function.
Re: Need help in calling function
Code:
int main(blah)
{
VectorDraw obj;
obj.FastRect();
}
Re: Need help in calling function
Syntax of calling a non-static member function is
object.Function(params)
Re: Need help in calling function
Quote:
Originally Posted by
Mybowlcut
How did you get this far without knowing how to call a member function? I'm not sure I quite understand why you wouldn't know, but all you have to do is #include the header file (drawtrack.h), create a VectorDraw object and call the function.
Actually I know how to create an object and call the function . The thing was I was traeting those files as an empty file . I hadn't stored it in some project . Those files were all over the plcaes and when I was trying to call it . It was snot getting called.
Srry for wasting your precious time . It's been a long day and now I'm going to sleep