Why virtual & static keywords aren’t allowed outside class declaration?

The modifiers must be on the function declarations, otherwise it would be impossible to call the functions given just the declarations.

Since they must be on the declarations, it would be redundant to put them on the definitions as well. There’s no particularly good reason to disallow them (as long as they match the declaration), but no particularly good reason to allow them either.

Leave a Comment