What is Interface Duck Typing?

后端 未结 5 1550
深忆病人
深忆病人 2020-12-08 07:29

I heard the word Interface Duck Typing, but do not understand at all what is it? So I read a wiki about this and they said:

In computer programming wi

5条回答
  •  死守一世寂寞
    2020-12-08 08:01

    It would say it is a way of coding where the you tell the compiler:

    "Hey trust me I know what methods and properties this object supports. You don't need to check them for me whilst I code."

    Once you run your app the compiler will go: "Ok lets see if I could trust you. Let me do some runtime binding."

    If you then made a mistake, such as using an unsupported method, the compiler will shout: "Hey man, this is not supported! Check my RuntimeBinderException!"

提交回复
热议问题