468,512 Members | 1,338 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,512 developers. It's quick & easy.

illegal call to non-static member function

2
I am facig a problem..
this is the basic structure of my code.

#define @#problem() aaa::fn()

class aaa {
fn();
}

this is aaa.h

In xxx.cc

#include "aaa.h"
#include "xxx.h"

xxx::fn2() {

@#problem()

}

And xxx.h contains the instance of class aaa

when I try to compile it I get the error : illegal call to non static member function . See declaration of aaa::fn
Sep 7 '06 #1
2 5147
Banfa
9,056 Expert Mod 8TB
This is because you have tried to envoke aaa:fn() directly with instantiating an object of type aaa and the member function fn is not static so it can only be invoked through an instance of the class aaa.
Sep 7 '06 #2
hhhh
2
so class aaa {
fn();
} obj;

#define @#problem() obj.fn()

should that do???
Sep 7 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Logu | last post: by
12 posts views Thread by Wilfried Mestdagh | last post: by
reply views Thread by Expert Humor | last post: by
5 posts views Thread by Roy Smith | last post: by
4 posts views Thread by Mathias Waack | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.