Why Can`t member function be called by pointer object of class/struct.

i was trying to call the member fuction of struct though pointer object it showed me error like

request for member 'Table::reveal' in `T1`, which is of non-class type 'Table*'

Table is structure
reveal is member function
T1 is the object pointer object created though

typedef Table *Tptr;
             Tptr T1;

if yes please help me out

Recommended Answers

All 2 Replies

Member access through pointers is different. If you try to do something like T1.reveal() , you would get that error because the dot operator does not work with pointers. You need to dereference the pointer first, then do the access:


Because it is such a common operation, there is a special operator to make the whole thing simpler:


thank a lot.. i had never done this with the function..........................

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.