Hi All,

I was trying out a simple program to understand array of function pointers in C++.
Code:
#include <iostream>

class a
{

  public:
  void func_1 ();
  void func_2();
  void (a::*arrfptr[2])();
  a();
};

void a::func_1()
{
  std::cout<<"\n func_1\n";
}
void a::func_2()
{
  std::cout<<"\n func_2\n";
}
a::a()
{
  a::arrfptr[0]=& a::func_1;
  a::arrfptr[1]=& a::func_2;
}

class b
{
  public:
  void func_b();
};

void b::func_b()
{
   a obj;
   (obj.*arrfptr[0]) ();
   (obj.*arrfptr[1]) ();
}

int main()

{
  b o;
  o.func_b();
}

while compiling I am getting this error
Code:
[root@localhost example]# g++ fptr.cpp
fptr.cpp: In member function ‘void b::func_b()’:
fptr.cpp:36: error: ‘arrfptr’ was not declared in this scope
[root@localhost example]#
arrfptr is public in class a then why i am not able to access it in class b ?

Thanking you in Advance