V
V
Vadim Ushakov2022-02-04 11:54:57
C++ / C#
Vadim Ushakov, 2022-02-04 11:54:57

Why is the default constructor considered deleted for my class?

There is a class declaration in the pure.hpp file.

class ElementPurified_Constant : public BaseClasses::Nameable
{
    //GetterSetterClass()

    private:
        PurifiedElement_Constants _properties;

    public:
        ElementPurified_Constant();
        //ElementPurified_Constant(PurifiedElement_Constants);

        ~ElementPurified_Constant() {};

        const std::string GetEnergyLevelsFormatted();
};

//static std::list<ElementPurified_Constant> PurifiedElements;

} }


There is an implementation code.

#include "Pure.hpp"

using namespace Machinarium::Materials;

Machinarium::Materials::ElementPurified_Constant::ElementPurified_Constant()
{
}


61fce9c26e29d184883941.png

What's with trying to use a remote function? This has never happened before, a banal implementation of a function constructor.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
Wataru, 2022-02-04
@Nightmare1

PurifiedElement_Constantsdoes not have a default constructor (very inconvenient names you have ElementPurified_Constantvs PurifiedElement_Constants- pay attention, the error is not about your class, but about the type _properties).
Those. a member _propertiesin your class cannot be constructed without some parameters.
You need to explicitly call the constructor _propertieswith some parameters in your class constructor:

Machinarium::Materials::ElementPurified_Constant::ElementPurified_Constant()
    : _properties(some, valid, parameters)
{
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question