Classes. What's the point?

后端 未结 12 1920
夕颜
夕颜 2020-12-03 03:09

I\'m fairly new to OOP in PHP, I\'ve made a couple of basic scripts but nothing impressive. All I\'ve really taken from it is that it would probably be easier just make a co

12条回答
  •  时光说笑
    2020-12-03 03:39

    Classes are a notion of object-oriented design (and programming and analysis, respectively), where they are used to encapsulate data and methods.

    Other object-oriented programming techniques may include features such as

    • information hiding,
    • data abstraction,
    • encapsulation,
    • modularity,
    • polymorphism and
    • inheritance

    From an article .. top-15-best-practices-for-writing-super-readable-code:

    Object oriented programming can help you create well structured code. But that does not mean you need to abandon procedural programming completely. Actually creating a mix of both styles can be good.

    From http://java.sun.com/docs/books/tutorial/java/concepts/class.html:

    In the real world, you'll often find many individual objects all of the same kind. There may be thousands of other bicycles in existence, all of the same make and model. Each bicycle was built from the same set of blueprints and therefore contains the same components. In object-oriented terms, we say that your bicycle is an instance of the class of objects known as bicycles. A class is the blueprint from which individual objects are created.

    Finally, a short youtube video about the differences between the procedural and object-oriented programming paradigm ...

提交回复
热议问题