Программы на C++. Форум разработчиков
-
Anonymous
Почему удаленные функции членов не распространяются через производные классы?
Сообщение
Anonymous »
Учитывая следующий фрагмент кода C ++: < /p>
Код: Выделить всё
#include
#include
template
struct Bar
{
Bar() = default;
Bar(const Bar&) = delete;
};
template
struct Foo : public Bar
{
Foo() = default;
Foo(const Foo& other) : Bar(other) {}
};
int main() {
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79441860/why-are-deleted-member-functions-not-propagated-through-derived-classes[/url]
1739694600
Anonymous
Учитывая следующий фрагмент кода C ++: < /p>
[code]#include
#include
template
struct Bar
{
Bar() = default;
Bar(const Bar&) = delete;
};
template
struct Foo : public Bar
{
Foo() = default;
Foo(const Foo& other) : Bar(other) {}
};
int main() {
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79441860/why-are-deleted-member-functions-not-propagated-through-derived-classes[/url]