RefactorMe with PhpLanguage
다음 내용은 O'Reilly에서 나온 Programming PHP를 메모 한 것입니다. 시간이 나면 더 정리해서 괜찮은 요약을 만들 생각입니다. Php 고수님들 조금씩 도와주세요. --flammy
다음 내용은 O'Reilly에서 나온 Programming PHP를 메모 한 것입니다. 시간이 나면 더 정리해서 괜찮은 요약을 만들 생각입니다. Php 고수님들 조금씩 도와주세요. --flammy
2. Objects ¶
ObjectOrientedProgramming (OOP) is a paradigm that relates the data and the code that works on the data. So it is not something that depends on the language, but it is a way of programming.
2.1. Terminology ¶
Different literature uses different terminology for the same concept.
* Class is a template for building objects.
* Object is an instance of a class. For example, there is only one int type, but there can be many int data.
* Properties are data associated with the object.
* Methods are the functions associated with an object.
* Debugging and maintenance of programs is much easier if encapsulation is used: only allow access to the properties through methods of the class. In PHP, encapsulation is not enforced by the language, but it is a convention.
* Object is an instance of a class. For example, there is only one int type, but there can be many int data.
* Properties are data associated with the object.
* Methods are the functions associated with an object.
* Debugging and maintenance of programs is much easier if encapsulation is used: only allow access to the properties through methods of the class. In PHP, encapsulation is not enforced by the language, but it is a convention.