Virtual function and abstract derived class

I want to make a base class (BaseTab) abstract and the derived class (AssetsTab) concrete, but the compiler is giving me an error that the derived class (AssetsTab) is abstract. The code works if BaseTab::create is not a pure virtual function.

1
2
3
4
5
6
7
    /// Base class declaration in BaseTab.hpp
    class BaseTab
    {
        public:
            /// Creates tabs.
            virtual void create() = 0;
    };


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
    /// Declaration of derived class in AssetsTab.hpp
    class AssetsTab :
        public BaseTab
    {
        public:
            /// Creates the tab.
            virtual void create( irr::gui::IGUIEnvironment* pEnv,
                      irr::gui::IGUITabControl* pTabControl,
                      wchar_t* ptrTabName,
                      irr::s32 Id_Tab,
                      wchar_t* pTreeLabel,
                      irr::s32 Id_Tree,
                      int appWidth,
                      int appHeight,
                      int toolBarBottom,
                      int statusBarTop,
                      int edgeSpace,
                      irr::s32 idButtonUpdate );
    };


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
    /// Implementation of derived class in AssetsTab.cpp
    void AssetsTab::create( irr::gui::IGUIEnvironment* pEnv,
                      irr::gui::IGUITabControl* pTabControl,
                      wchar_t* pTabName,
                      irr::s32 Id_Tab,
                      wchar_t* pTreeLabel,
                      irr::s32 Id_Tree,
                      int appWidth,
                      int appHeight,
                      irr::s32 toolBarBottom,
                      irr::s32 statusBarTop,
                      irr::s32 edgeSpace,
                      irr::s32 idButtonUpdate  )
    {
        /* implementation */
    }
Last edited on
For AssetsTab::create to overload the pure virtual in BaseTab, it must have the same signature. It does not.
Oh. Thank you!
Topic archived. No new replies allowed.