EN VI

What is Object?

Objects are key to understanding object-oriented technology. Look around right now and you'll find many examples of real-world objects: your dog, your desk, your television set, your bicycle.

Real-world objects share two characteristics: They all have state and behavior. Dogs have state (name, color, breed, hungry) and behavior (barking, fetching, wagging tail). Bicycles also have state (current gear, current pedal cadence, current speed) and behavior (changing gear, changing pedal cadence, applying brakes). Identifying the state and behavior for real-world objects is a great way to begin thinking in terms of object-oriented programming.

Software objects are conceptually similar to real-world objects: they too consist of state and related behavior. An object stores its state in fields (variables in some programming languages) and exposes its behavior through methods (functions in some programming languages). Methods operate on an object's internal state and serve as the primary mechanism for object-to-object communication. Hiding internal state and requiring all interaction to be performed through an object's methods is known as data encapsulation — a fundamental principle of object-oriented programming.
Posts (2)
Questions (5)
2022-05-09 11:19:57
Objects & Classes (Đối Tượng và Lớp) Trong PHP
1. Class trong PHP là gì?    Một class là một khuôn mẫu đại diện cho một thực thể trong thế giới thực và nó định nghĩa các thuộc tính và phương thức của thực thể. Trong phần này, chúng ta sẽ thảo luận...
0
2022-05-09 11:46:59
Constructor và Destructor trong lập trình hướng đối tượng PHP là gì
1. Constructor là gì?    Hàm constructor là kiểu hàm đặc biệt mà sẽ được gọi tự động bất cứ khi nào có một sự tạo thành đối tượng từ một Class. Vì thế, chúng ta lợi dụng cách vận hành này, bằng việc k...
0

Login


Forgot Your Password?

Create Account


Lost your password? Please enter your email address. You will receive a link to create a new password.

Reset Password

Back to login