c++c++11inheritancemultiple-constructorsinheriting-constructors

Inheriting constructors work only partially


I have following class, written so, as to work completely, whatever the typedef is:

class A
{
protected:
    typedef uchar mDataType;
    std::vector<mDataType> mData;

    uint32 mWidth;
    uint32 mHeight;

    friend class C;
public:
    A();
    A(void* data, uint32 width, uint32 height, size_t dataSize);
    A(const A& other);
    A(A&& other);
    A& operator=(const A& other);
    A& operator=(A&& other) = delete;

    ~A();
}

I wanted to make a subclass, that is actually almost the same, apart from overloaded typedef:

class B : public A
{
private:
    typedef float mDataType;
public:
    using A::A;
    using A::operator=;
};

What I wanted to achieve was to make a class B, that is: - identical to A - has all of As functions (there are few member functions in A, that I've not written) - has all of As operators - has all of As constructors - has different typedef - has the same destructor

My code does not work, because I can't call B(void*, uint32, uint32, size_t), which is what I want. (Intellisense shows me only B() and B(const B&) as available constructors).


Solution

  • Inheriting constructors are only supported since VC++2014 CTP 1.