search
HomeBackend DevelopmentPHP TutorialProgrammers share learning experience about PHP interface_PHP tutorial
Programmers share learning experience about PHP interface_PHP tutorialJul 21, 2016 pm 02:56 PM
phpaboutsharestudycollegeBuild a websiteinterfaceofprogrammernetwork programming

 Bkjia.Com Network ProgrammingI recently encountered difficulties in learning the PHP5 interface. The book says it is a way to achieve multiple inheritance, but I still don’t know. How to implement it specifically. There is very little information on the PHP interface on the Internet, so I checked on Java. In fact, they are basically the same. After reading the article "Clarifying Java (Interfaces and Inheritance)", I suddenly realized that I had misunderstood it from the beginning. The so-called multiple inheritance refers to interfaces inheriting classes, not classes inheriting interfaces.

The article mentioned the abstraction of OO, just like the sentence in the article - "Abstraction is to remove the image part", it is very vivid. When I thought about abstraction in the past, I always thought it was difficult to understand. It is abstract, haha, now it is It's easy to understand, and this is exactly what interfaces and abstract classes do.

There are many other points of view in the article that have benefited me a lot, as listed below:

I think the essence of OO is the abstraction of objects.

The role of the interface, in a nutshell, is to mark the type of class. Attributing different types of classes to different interfaces can better manage them.

The meaning of inheritance also lies in abstraction, not code reuse.

After reading this article, I now basically understand how to apply interfaces, abstract classes, and inheritance.

The original text is as follows:

Clarification of Java (Interfaces and Inheritance) My brother who is a second-year graduate student in the School of Computer Science discussed Java with me. When we met, several questions were all about interfaces. What is the use of interfaces? Why use interfaces? When should you use interfaces? I'm glad they didn't ask me how to connect to SQL Server using Java, or how to develop J2EE applications. Such questions are lethal and should be avoided. This year, the School of Computer Science has a graduation project project on J2ME. The students who chose this topic were still studying the java.util.* package with a grimace at the end of May, this and this... sigh.

Most people think that the purpose of interfaces is to replace multiple inheritance. As we all know, Java does not have a multiple inheritance mechanism like C++, but it can implement multiple interfaces. In fact, this is far-fetched. Interfaces and inheritance are completely different things. Interfaces have no ability to replace multiple inheritance, and they have no such obligation. The function of the interface, in a nutshell, is to mark the type of class. Attributing different types of classes to different interfaces can better manage them. I think the essence of OO is the abstraction of objects, and the interface best embodies this. Why we discuss design patterns only for languages ​​with abstract capabilities (such as c++, java, c#, etc.) is because what design patterns study is actually how to abstract reasonably. (Cowboy's famous saying is "Abstraction is to remove the image part", which seems to be a joke, but is actually true).

The most basic design pattern is the Factory pattern. In my recent very simple application, I wanted to try my best to make my program portable between multiple databases. Of course, this involves many problems. Just how to be compatible with SQL of different DBMS is a headache. We might as well simplify the problem first and only consider how to connect different databases.

  • Total 2 pages:
  • Previous page
  • 1
  • 2
  • Next page

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/364210.htmlTechArticleLieHuo.Net Network Programming recently encountered difficulties in learning the PHP5 interface. The book says It is a way to implement multiple inheritance, but I still don’t know how to implement it...
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
揭秘C语言的吸引力: 发掘程序员的潜质揭秘C语言的吸引力: 发掘程序员的潜质Feb 24, 2024 pm 11:21 PM

学习C语言的魅力:解锁程序员的潜力随着科技的不断发展,计算机编程已经成为了一个备受关注的领域。在众多编程语言中,C语言一直以来都备受程序员的喜爱。它的简单、高效以及广泛应用的特点,使得学习C语言成为了许多人进入编程领域的第一步。本文将讨论学习C语言的魅力,以及如何通过学习C语言来解锁程序员的潜力。首先,学习C语言的魅力在于其简洁性。相比其他编程语言而言,C语

接私活挣钱!2023程序员接单平台大全!接私活挣钱!2023程序员接单平台大全!Jan 09, 2023 am 09:50 AM

上周我们做了一次关于《2023PHP创业》的公益直播,很多同学咨询具体有哪些接单平台,下面php中文网整理了22个还算靠谱的平台,以供参考!

2023过年,又限制放烟花?程序猿有办法!2023过年,又限制放烟花?程序猿有办法!Jan 20, 2023 pm 02:57 PM

本篇文章给大家介绍如何用前端代码实现一个烟花绽放的绚烂效果,其实主要就是用前端三剑客来实现,也就是HTML+CSS+JS,下面一起来看一下,作者会解说相应的代码,希望对需要的朋友有所帮助。

程序员是做什么的程序员是做什么的Aug 03, 2019 pm 01:40 PM

程序员的工作职责:1、负责软件项目的详细设计、编码和内部测试的组织实施;2、协助项目经理和相关人员同客户进行沟通,保持良好的客户关系;3、参与需求调研、项目可行性分析、技术可行性分析和需求分析;4、熟悉并熟练掌握交付软件部开发的软件项目的相关软件技术;5、负责向项目经理及时反馈软件开发中的情况;6、参与软件开发和维护过程中重大技术问题的解决;7、负责相关技术文档的拟订等等。

520程序员专属浪漫表白方式!无法拒绝!520程序员专属浪漫表白方式!无法拒绝!May 19, 2022 pm 03:07 PM

520将至,年度虐汪大戏他又双叒叕来啦!想看看最理性的代码和最浪漫的告白究竟能碰撞出怎样的火花?下面带你逐一领略最全最完整的告白代码,看看程序员们的浪漫是否能够掳获各位心目中女神的芳心呢?

浅析怎么下载安装VSCode历史版本浅析怎么下载安装VSCode历史版本Apr 17, 2023 pm 07:18 PM

VSCode历史版本的下载安装 VSCode安装 下载 安装 参考资料 VSCode安装 Windows版本:Windows10 VSCode版本:VScode1.65.0(64位User版本) 本文

2022年最佳的Windows 11终端仿真器列表:Top 15款推荐2022年最佳的Windows 11终端仿真器列表:Top 15款推荐Apr 24, 2023 pm 04:31 PM

终端仿真器允许您模仿标准计算机终端的功能。有了它,您可以执行数据传输并远程访问另一台计算机。当与Windows11等高级操作系统结合使用时,这些工具的创造性可能性是无穷无尽的。但是,有很多第三方终端仿真器可用。因此,很难选择合适的。但是,正如我们对必备的Windows11应用所做的那样,我们选择了您可以使用的最佳终端并提高您的工作效率。我们如何选择最好的Windows11终端模拟器?在选择此列表中的工具之前,我们的专家团队首先测试了它们与Windows11的兼容性。我们还检查了他们

Devin第一手使用体验:完成度很高,开始编码就停不下来,但要替代程序员还很远Devin第一手使用体验:完成度很高,开始编码就停不下来,但要替代程序员还很远Mar 18, 2024 pm 03:30 PM

由10枚IOI金牌在手的创业团队CognitionAI开发的全球首个AI程序员智能体Devin,一发布就让科技圈坐立不安。在演示中,Devin几乎已经可以独立完成许多需要普通程序员花费大量时间才能完成的任务,而且表现一点也不逊色于普通程序员。但是,产品能力的边界在哪里,实际体验和演示时候有差距,还的看上手实测之后的效果。这位斯坦福的小哥在Devin发布的第一时间就联系了团队,获得了第一手体验的资格。他让Devin帮它做了几个难度不一的项目,录制了一个视频,在推上写下了自己的使用感受。下一个任务是

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.