首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

静态成员函数单链表安插

2013-01-12 
静态成员函数单链表插入class A {struct B {C *m_functionstruct B *m_next}static struct B *head pu

静态成员函数单链表插入
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->m_function = f;
         head->m_next = old;
 
}
 
C::C()
 {
 
        A::insert(this);
 }
 
有段错误 
[解决办法]

引用:
class A {
 
        struct B {
                 C *m_function;
                 struct B *m_next;
         };
 
        static struct B *head;
 
public:
         static void ins……


什么错误?

热点排行