This question is more aimed at good design practices rather than exceptions and stacks. My apologies for not being clear at first.
I want to play about with havin
Perhaps I'm missing something in your design but, you don't need to do anything special to make sure a class "can" throw an exception. Any class can throw any exception it wants any time. The only requirement is that the exception class be visible.
Make sure the exception is in the same assembly and same namespace as your interface and you'll be fine.
public interface IStack
{
bool IsEmpty();
int Pop();
void Push(int element);
int Size { get; set; }
int Top();
}
public class Empty : Exception
{
}