FS class requires a virtual destructor

jmarsh

Well-known member
The FS class, designed as an interface to be implemented by a derived class, has no virtual destructor. If an address of a derived class object is cast down to FS* and deleted, the destructor of the derived object will not be called. This makes FS unsuitable for use with dynamic (runtime-created) objects and triggers a compiler warning: "class has virtual functions but non-virtual destructor".

I would suggest adding:
Code:
virtual ~FS() = default;           // alternatively: virtual ~FS() {}
to the existing FS class definitions.
 
Back
Top