What Is an LZX Object?

When developing an application in an OOP language, you create a model that resembles a real-life situation to solve your problem. Take for example a company payroll application, which can calculate the take home pay of an employee and the amount of income tax to be paid. An application like this would have a Company object to represent the company using the application, Employee objects that represent the employees in the company, Tax objects to represent the tax details of each employee, and so on. Before you can start programming such applications, however, you need to understand what objects are and how to create them.

Let’s begin with a look at objects in life. Objects are everywhere, living (persons, pets, etc) and otherwise (cars, houses, streets, etc); concrete (books, televisions, etc) and abstract (love, knowledge, tax rate, regulations, and so forth). Every object has two features: attributes and actions the object is able to perform. For example, the following are some attributes of a car:

  • color

  • number of tires

  • plate number

  • number of valves

Additionally, a car can perform these actions:

  • run

  • brake

As another example, a dog has the following attributes: color, age, type, weight, etc. And it also can bark, run, urinate, sniff, etc.

An LZX object also has attributes(s) and can perform actions. In LZX methods are called functions. In other languages, attributes are often called fields.

Both attributes and methods are optional, meaning that some LZX objects may not have attributes but have methods and some others may have attributes but not methods. Some, of course, have both attributes and methods and some have neither.

How do you create LZX objects? This is the same as asking, “How do you make cars?” Cars are expensive objects that need careful design that takes into account many things, such as safety and cost-effectiveness. You need a good blueprint to make good cars. To create LZX objects, you need similar blueprints: classes.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset