This is a creation in Article, where the information may have evolved or changed. then I wrote some test code:DEPT1:= dept{ Name: "Mysohu", Building: Internet, Floor: 7}switch V: = interface{} (DEPT1). (type) {Case deptmodefull: FMT. Printf ("The DEPT1 is a deptmodefull.\n") Case deptmodeb: FMT. Printf ("The DEPT1 is a deptmodeb.\n") Case deptmodea: FMT. Printf ("The DEPT1 is a deptmodea.\n") default: FMT. Printf ("The type of DEPT1 is%v\n", v)}deptptr1: = &dept1if _, OK: = interface{} (DEPTPTR1). (Deptmodefull); OK { FMT. Printf ("The DEPTPTR1 is a deptmodefull.\n")}if _, OK: = interface{} (DEPTPTR1). (Deptmodea); OK { FMT. Printf ("The DEPTPTR1 is a deptmodea.\n")}if _, OK: = interface{} (DEPTPTR1). (Deptmodeb); OK { FMT. Printf ("The DEPTPTR1 is a deptmodeb.\n")} Print out the content
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.