   virtual const functions?
  I've been trying to rewrite my classes to be const-correct, but I've run into a problem. It won't compile.It always gets stuck on this line and says 'error: declaration does not declare anything'What should I do? What is the correct way to write virtual const functions?    virtual void display(SDL_Surface*,int=0,int=0) {} const;Here is the other code around it in case that helps.#ifndef GUICLASSES_H#define GUICLASSES_H#include "SDL/SDL.h"#include "SDL_TTF.h"#include "shared_ptr.hpp"#include "imagemanager.h"#include <vector>#include <string>typedef void(*funcptr)();//////////////////////////////////////////////////////////////class gObject{    protected:    int top;    int left;    int width;    int height;    bool visible;    bool enabled;    public:    gObject();    virtual ~gObject() {};    virtual bool mouseClick(Uint8, Uint8,int,int) {return false;};    virtual void mouseMove(Uint8, int,int) {};    virtual void display(SDL_Surface*,int=0,int=0) {} const;    virtual void setXYWH(int,int,int,int);    virtual void setEnabled(bool arg) {enabled=arg;};    virtual bool isEnabled() {return enabled;} const;    virtual void setVisible(bool arg) {visible=arg;};    virtual bool isVisible() {return visible;} const;};class gButton: public gObject{    funcptr onLeftClick;    img_sptr image;    int clipx, clipy;    public:    gButton();    void setImage( std::string);    void setImage( std::string, int, int , int );    void setClipRect( int, int);    void setFunction(funcptr);    bool mouseClick(Uint8, Uint8,int,int);    void display(SDL_Surface*,int=0,int=0) const;};class gFrame: public gObject{    //the frame serves as a container to hold other objects    //input and output functions can be called on its contents recursively    //the top and left values of its contents are stored in relative coordinates    std::vector<gObject*> contents;    img_sptr background;    SDL_Rect *bgcliprect;    int clipx, clipy;    bool hasbg;    public:    gFrame();    void setBG( std::string );    void setClipRect( int, int);    bool mouseClick(Uint8, Uint8,int,int);    void mouseMove(Uint8, int, int);    void display(SDL_Surface*,int=0,int=0); const    void add(gObject*);    ~gFrame();};class gText: public gObject{    TTF_Font *font;    SDL_Surface *txtsurf;    std::string caption;    SDL_Color forecolor;    void rerenderText();    public:    gText();    void setCaption( std::string);    void setFont( std::string, int);    void setForeColor(int,int,int);    void display(SDL_Surface*,int=0,int=0) const;    ~gText();};#endif
  const goes before the {}s.   ;  This is what the first code snippet looks like to the compiler:virtual void display(SDL_Surface*,int=0,int=0) {} // end of method declarationconst; // compiler thinks:  "what is this?  a standalone const?";  Ok, I got it working. Thanks for the explanation.   