From the course: Introduction to Dart

Objects: Reality and Dart - Dart Tutorial

From the course: Introduction to Dart

Objects: Reality and Dart

- [Instructor] We are surrounded by objects. Everything we own is an object, from the car we drive to the gadgets we purchase. Every object has traits and behaviors. A car, for example, has characteristics such as its manufacturer, model, and year. A car can also do things like accelerate and reverse. These characteristics and behaviors, when combined, define the car's identity. Similarly, everything in Dart is an object. Objects in the programming language can also have properties and perform actions known as methods. The object's properties and methods represent both its knowledge and capabilities. In Dart, an object is made up of two components, data and methods. Objects communicate with one another via methods. Each object has the ability to receive messages, send messages, and process data. So what are the characteristics of objects? Individual objects share three fundamental characteristics, identity, state, and behavior. Getting familiar with these properties is critical to understanding how objects and object-oriented logic work. Let's take a closer look at each of these characteristics. One of the most important characteristics of any object is its identity. Each object can be distinguished from others due to its unique object identifier. This implies that the name or identity of an object distinguishes it from others. The state of an object is another distinguishing feature. This represents an object property. Variable values in an object, for example, contain data that can be added, changed, or deleted. Don't worry if you are unfamiliar with the term, variable, you'll learn more about it in the next lesson. Finally, there is one more object feature to consider, it's known as behavior. These are possible actions for the object. One object, for example, can respond to another to perform specific functions. Objects can do things and can have things done to them. Understanding its identity, state and behavior will assist you in using it to represent objects in your future Dart projects.

Contents