I have written a sample code,

class A
{
public:
void func1(X *ptr);
};

class B
{
public:
void func2(X **ptr);
};

void A::funct1(X *ptr)
{
//some code here
}

void B::funct2(X **ptr)
{
//some code here
X *ptr;
*ptr->func1(*ptr);
}

main()
{
B Bobj;
X **ptr;
Bobj.funct2(**ptr);
return 0;
}

and i am getting the following lines while i compile the above code in LINUX environment,

In member function âvoid B::func2(X**)â:
error: request for member âfunc1â in â* ptrâ, which is of non-class type âX*â
In function âint main()â:
error: no matching function for call to âB::func2(X&)â
note: candidates are: void B::func2(X**)

How to resolve/correct my code?

Please help!!

Thanks in advance.

It looks like you have not defined the type/class 'X'.

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.