Can enum have attributes?

An enum can, just like a class , have attributes and methods . The only difference is that enum constants are public , static and final (unchangeable – cannot be overridden). An enum cannot be used to create objects, and it cannot extend other classes (but it can implement interfaces).

Sizin İçin Seçtik  Is Swift same as Python?

Leave a Reply

Your email address will not be published. Required fields are marked *