单链表安插

单链表插入
class A {
 
        struct B {
                 C *m_function;
                 struct B *m_next;
         };
 
        static struct B *head;
 
public:
         static void insert(C *f);
 };
 
A::B *A::head;
 
void A::insert(C *f)
 {
         struct B *old=head;
         head = new struct B;
         head->C = f;
         head->m_next = old;
 
}
 
C::C()
 {
 
        A::insert(this);
 }
 
有段错误 

------解决方案--------------------
不知道你想要什么,你的代码也不全,我自己加了一下。自己看吧,只是编译可过,
是不是你想要的不知道。

class C;
class A 
{
struct B 
{
C *m_function;
struct B *m_next;
};
static struct B *head;
public:
static void insert(C *f);
};

class C
{
public:
C()
{
A::insert(this);
}
};

A::B *A::head;

void A::insert(C *f)
{
struct B *old=head;
head = new struct B;
head->m_function = f;
head->m_next = old;
}