Derived class User-defined Destructor Error
08:04 29 Apr 2026

The code is having an issue when I declare the ~Strategy destructor in the Concrete class that is a derived class from Strategy. In this instance, I want my destructor to be a user-defined destructor rather than a default. I'm getting an error when I declare the destructor though.

class Strategy
{
    public:
        virtual ~Strategy()=default;
        virtual void doSomething()=0;
};

class Concrete : public Strategy{
    public:
        ~Strategy() override;
        // {
        //     //delete resource in non-default way.
        // };

        void doSomething() override
        {
                // do something;
        }
};
source>:1:1: error: 'st' does not name a type 
1 | st 
  | ^~
c++