in C++ what does the not operator '~' do when it is beside a method? and Pure virtual method : Example Code Below,


    #include <string>
    
    namespace vehicle
    {
        class Vehicle
        {
        public:
            Vehicle(int a);
    
            virtual ~Vehicle();   <------ not method?
    
        protected:
            int a;
        };
    }


Also, I don't fully get the concept of the 'Pure Virtual Method' where you declare a method as 

    virtual method() = 0;

Why do we need this?

Thanks alot,
 