...

/

The Type Switch

The Type Switch

In this lesson, you'll learn how to use the switch statement to determine the type of interface and writing cases accordingly.

Testing the type of interface #

The type of an interface variable can also be tested with a special kind of switch: the type-switch. Look at the following program:

Access this course and 40+ top-rated courses and projects.