467,166 Members | 1,130 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

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

what does this error means "cannot call member function 'X' without object "

Can anyone direct me to the place where i find the solution for the
error message "cannot call member function 'X' without object"???
thanks in advance

May 17 '07 #1
  • viewed: 22243
Share:
2 Replies
mahesh wrote:
Can anyone direct me to the place where i find the solution for the
error message "cannot call member function 'X' without object"???
thanks in advance
Yes, try http://www.parashift.com/c++-faq-lit...t.html#faq-5.8

However, the error is fairly clear. You are trying to call a member
function X. You must have an object to call X on, e.g.

either

T obj;
obj.X();

or

T *obj = new T;
obj->X();

Since I doubt that you are making a T::X() call directly in your code, I
suspect you have a static member function in T, and are trying to call
X() from within it. Won't work. A static member function doesn't have
a this pointer, so you still need a pointer to, a reference to, or an
actual T object to call X() on.

May 17 '07 #2
mahesh wrote:
Can anyone direct me to the place where i find the solution for the
error message "cannot call member function 'X' without object"???
thanks in advance
The place in your code where you attempt to call a class member function
without an instance of the class?

--
Ian Collins.
May 17 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by Thorsten Ottosen | last post: by
5 posts views Thread by loudwinston@gmail.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.