I have problem in this line std::cout << &X::a << std::endl;
this line print 1 supposed to printed address of &X::a
this my code
#include <iostream>
#include <string>
#include <iomanip>
class X
{
public:
int a;
void f(int b);
};
void X::f(int b)
{
std::cout << "the value of b is " << b << std::endl;
}
void add()
{
std::cout << "Hello this function hello" << std::endl;
}
int main()
{
void (*funcPtr)(void) = add;
funcPtr();
int X::*ptrnumber = &X::a;
void (X::*ptrfunction)(int) = &X::f;
X xobj;
xobj.*ptrnumber = 10;
std::cout << "the vslue of a is " << xobj.*ptrnumber << std::endl;
(xobj.*ptrfunction)(20);
std::cout << std::hex << &X::a << std::endl;
//std::cout << funcPtr << std::endl;
}
i compiled with different complier c++ but i have same output
i displayed type of this "M1Xi" i don't know this data type