So on https://en.cppreference.com/w/cpp/language/rule_of_three it says:
Because the presence of a user-defined (or = default or = delete declared) destructor, copy-constructor, or copy-assignment operator prevents implicit definition of the move constructor and the move assignment operator, any class for which move semantics are desirable, has to declare all five special member functions
So for this class I've done the following
#include <string>
#include <iostream>
class Data {
private:
std::string m_name;
public:
Data() { m_name = "stackman"; }
~Data() = default;
Data(const Data&) = delete;
Data& operator=(const Data&) = delete;
Data(Data&&) = delete;
Data& operator=(Data&&) = delete;
std::string get_name() { return m_name; }
};
int main()
{
Data person;
std::cout << person.get_name() << std::endl;
}
I've seen conflicting resources online saying that if the destructor is set to default and if you don't need the other constructors you don't need to delete or define them. So what's the best course of action here?