gpt4 book ai didi

php - 上课。重点是什么?

转载 作者:IT王子 更新时间:2023-10-28 23:52:30 25 4
gpt4 key购买 nike

我对 PHP 中的 OOP 相当陌生,我制作了几个基本脚本,但没有什么令人印象深刻的。我真正从中学到的是,创建一个函数集合并包含它们可能会更容易。

类的结构似乎只是混淆了原本简单的过程。在将所有内容整理到一个类中时,它并没有真正添加任何功能。

所以我显然遗漏了一些东西。有人可以解释通过创建类添加了什么功能

最佳答案

类是面向对象设计(分别是编程和分析)的概念,用于封装数据和方法

其他面向对象的编程技术可能包括诸如

  • 信息隐藏,
  • 数据抽象,
  • 封装,
  • 模块化,
  • 多态性和
  • 继承

来自一篇文章.. 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.

来自 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.

最后,一个简短的youtube video关于面向过程和面向对象编程范式之间的区别...

关于php - 上课。重点是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1993638/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com