Added missing virtual keywords to destructors
This commit is contained in:
Alessandro Ferro 2021-05-25 23:06:28 +02:00
parent b3ca7292c1
commit 31f7ae9b35
26 changed files with 27 additions and 25 deletions

View File

@ -45,7 +45,7 @@ protected:
/* ********************************************************************** */ /* ********************************************************************** */
// Destructor // Destructor
~Node() = default; virtual ~Node() = default;
/* ********************************************************************** */ /* ********************************************************************** */
@ -83,7 +83,7 @@ public:
/* ************************************************************************ */ /* ************************************************************************ */
// Destructor // Destructor
~List(); virtual ~List();
/* ************************************************************************ */ /* ************************************************************************ */

View File

@ -40,7 +40,7 @@ public:
Vector(Vector&&)noexcept; Vector(Vector&&)noexcept;
// Destructor // Destructor
~Vector(); virtual ~Vector();
// Copy assignment // Copy assignment
Vector& operator=(const Vector&); Vector& operator=(const Vector&);

View File

@ -45,7 +45,7 @@ protected:
/* ********************************************************************** */ /* ********************************************************************** */
// Destructor // Destructor
~Node() = default; virtual ~Node() = default;
/* ********************************************************************** */ /* ********************************************************************** */
@ -83,7 +83,7 @@ public:
/* ************************************************************************ */ /* ************************************************************************ */
// Destructor // Destructor
~List(); virtual ~List();
/* ************************************************************************ */ /* ************************************************************************ */

View File

@ -47,7 +47,7 @@ public:
/* ************************************************************************ */ /* ************************************************************************ */
// Destructor // Destructor
~QueueLst(); virtual ~QueueLst();
/* ************************************************************************ */ /* ************************************************************************ */

View File

@ -22,7 +22,7 @@ protected:
public: public:
// Destructor // Destructor
~Queue() = default; virtual ~Queue() = default;
/* ************************************************************************ */ /* ************************************************************************ */

View File

@ -40,7 +40,7 @@ public:
Vector(Vector&&)noexcept; Vector(Vector&&)noexcept;
// Destructor // Destructor
~Vector(); virtual ~Vector();
// Copy assignment // Copy assignment
Vector& operator=(const Vector&); Vector& operator=(const Vector&);

0
librerie/exercise3/list/list.cpp Executable file → Normal file
View File

4
librerie/exercise3/list/list.hpp Executable file → Normal file
View File

@ -45,7 +45,7 @@ protected:
/* ********************************************************************** */ /* ********************************************************************** */
// Destructor // Destructor
~Node() = default; virtual ~Node() = default;
/* ********************************************************************** */ /* ********************************************************************** */
@ -83,7 +83,7 @@ public:
/* ************************************************************************ */ /* ************************************************************************ */
// Destructor // Destructor
~List(); virtual ~List();
/* ************************************************************************ */ /* ************************************************************************ */

View File

@ -47,7 +47,7 @@ public:
/* ************************************************************************ */ /* ************************************************************************ */
// Destructor // Destructor
~QueueLst(); virtual ~QueueLst();
/* ************************************************************************ */ /* ************************************************************************ */

View File

@ -22,7 +22,7 @@ protected:
public: public:
// Destructor // Destructor
~Queue() = default; virtual ~Queue() = default;
/* ************************************************************************ */ /* ************************************************************************ */

0
librerie/exercise3/vector/vector.cpp Executable file → Normal file
View File

2
librerie/exercise3/vector/vector.hpp Executable file → Normal file
View File

@ -40,7 +40,7 @@ public:
Vector(Vector&&)noexcept; Vector(Vector&&)noexcept;
// Destructor // Destructor
~Vector(); virtual ~Vector();
// Copy assignment // Copy assignment
Vector& operator=(const Vector&); Vector& operator=(const Vector&);

View File

@ -15,10 +15,11 @@ protected:
protected: protected:
using BinaryTree<Data>::Node::data; using BinaryTree<Data>::Node::data;
public:
struct NodeLnk* left = nullptr; struct NodeLnk* left = nullptr;
struct NodeLnk* right = nullptr; struct NodeLnk* right = nullptr;
public:
struct NodeLnk& operator=(const NodeLnk&); // Copy assignment of abstract types should not be possible. struct NodeLnk& operator=(const NodeLnk&); // Copy assignment of abstract types should not be possible.
struct NodeLnk& operator=(NodeLnk&&) noexcept; // Move assignment of abstract types should not be possible. struct NodeLnk& operator=(NodeLnk&&) noexcept; // Move assignment of abstract types should not be possible.
bool IsLeaf() const noexcept override; // (concrete function should not throw exceptions) bool IsLeaf() const noexcept override; // (concrete function should not throw exceptions)

0
librerie/exercise4/list/list.cpp Executable file → Normal file
View File

4
librerie/exercise4/list/list.hpp Executable file → Normal file
View File

@ -45,7 +45,7 @@ protected:
/* ********************************************************************** */ /* ********************************************************************** */
// Destructor // Destructor
~Node() = default; virtual ~Node() = default;
/* ********************************************************************** */ /* ********************************************************************** */
@ -83,7 +83,7 @@ public:
/* ************************************************************************ */ /* ************************************************************************ */
// Destructor // Destructor
~List(); virtual ~List();
/* ************************************************************************ */ /* ************************************************************************ */

View File

@ -47,7 +47,7 @@ public:
/* ************************************************************************ */ /* ************************************************************************ */
// Destructor // Destructor
~QueueLst(); virtual ~QueueLst();
/* ************************************************************************ */ /* ************************************************************************ */

View File

@ -22,7 +22,7 @@ protected:
public: public:
// Destructor // Destructor
~Queue() = default; virtual ~Queue() = default;
/* ************************************************************************ */ /* ************************************************************************ */

0
librerie/exercise4/vector/vector.cpp Executable file → Normal file
View File

2
librerie/exercise4/vector/vector.hpp Executable file → Normal file
View File

@ -40,7 +40,7 @@ public:
Vector(Vector&&)noexcept; Vector(Vector&&)noexcept;
// Destructor // Destructor
~Vector(); virtual ~Vector();
// Copy assignment // Copy assignment
Vector& operator=(const Vector&); Vector& operator=(const Vector&);

View File

@ -15,10 +15,11 @@ protected:
protected: protected:
using BinaryTree<Data>::Node::data; using BinaryTree<Data>::Node::data;
public:
struct NodeLnk* left = nullptr; struct NodeLnk* left = nullptr;
struct NodeLnk* right = nullptr; struct NodeLnk* right = nullptr;
public:
struct NodeLnk& operator=(const NodeLnk&); // Copy assignment of abstract types should not be possible. struct NodeLnk& operator=(const NodeLnk&); // Copy assignment of abstract types should not be possible.
struct NodeLnk& operator=(NodeLnk&&) noexcept; // Move assignment of abstract types should not be possible. struct NodeLnk& operator=(NodeLnk&&) noexcept; // Move assignment of abstract types should not be possible.
bool IsLeaf() const noexcept override; // (concrete function should not throw exceptions) bool IsLeaf() const noexcept override; // (concrete function should not throw exceptions)

0
librerie/exercise5/list/list.cpp Executable file → Normal file
View File

4
librerie/exercise5/list/list.hpp Executable file → Normal file
View File

@ -45,7 +45,7 @@ protected:
/* ********************************************************************** */ /* ********************************************************************** */
// Destructor // Destructor
~Node() = default; virtual ~Node() = default;
/* ********************************************************************** */ /* ********************************************************************** */
@ -83,7 +83,7 @@ public:
/* ************************************************************************ */ /* ************************************************************************ */
// Destructor // Destructor
~List(); virtual ~List();
/* ************************************************************************ */ /* ************************************************************************ */

View File

@ -47,7 +47,7 @@ public:
/* ************************************************************************ */ /* ************************************************************************ */
// Destructor // Destructor
~QueueLst(); virtual ~QueueLst();
/* ************************************************************************ */ /* ************************************************************************ */

View File

@ -22,7 +22,7 @@ protected:
public: public:
// Destructor // Destructor
~Queue() = default; virtual ~Queue() = default;
/* ************************************************************************ */ /* ************************************************************************ */

0
librerie/exercise5/vector/vector.cpp Executable file → Normal file
View File

2
librerie/exercise5/vector/vector.hpp Executable file → Normal file
View File

@ -40,7 +40,7 @@ public:
Vector(Vector&&)noexcept; Vector(Vector&&)noexcept;
// Destructor // Destructor
~Vector(); virtual ~Vector();
// Copy assignment // Copy assignment
Vector& operator=(const Vector&); Vector& operator=(const Vector&);