C++ Programming - Objects and Classes - Discussion

Discussion Forum : Objects and Classes - General Questions (Q.No. 24)
24.
Which of the following statements is correct about the program given below?
class Bix
{
    public:
    static void MyFunction();
};
int main()
{
    void(*ptr)() = &Bix::MyFunction;
    return 0; 
}
The program reports an error as pointer to member function cannot be defined outside the definition of class.
The program reports an error as pointer to static member function cannot be defined.
The program reports an error as pointer to member function cannot be defined without object.
The program reports linker error.
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
19 comments Page 2 of 2.

Ankit.w. said:   1 decade ago
Function in main should be like :

void (Bix::*ptr)()= &Bix::Myfunction;

Prem said:   9 years ago
Linker error because there is no function definition for MyFunction().

K SOWJANYA said:   1 decade ago
Can anybody explains clearly why it reports linking error?

Rakesh said:   1 decade ago
void(*ptr)() = &Bix::MyFunction;

What this line do?

Lenold said:   1 decade ago
Void data type should not return any value.

Jayendrashirsat said:   1 decade ago
:: what does this operator do?

Pavan said:   10 years ago
What is mean by linker error?

Babbu said:   1 decade ago
What is linker error?

Likitha said:   1 decade ago
Can someone explain?


Post your comments here:

Your comments will be displayed after verification.