The compiler doesn't necessarily know whether or not a implements G or not.
Casting pretty much tells the compiler to take this variable, and treat it like a different type.
If you try to do an operation on the cast variable as though it implemented G(when it doesn't) you'll get a runtime error