QUIZGUM

Coding Class

Quizgum : property

Using properties

Properties are variables
Within a class, you name a variable as a property.

How to use properties

  1. <?php
  2. class classname
  3. {
  4. Property name;
  5. or
  6. Property name = value;
  7. }
  8. ?>

I'll continue the course in front of you.
What would a car look like, wheels, doors, what color, medium, heavy or truck, a car company, and so on?
In the next lesson, we will create wheel variables, door variables, color variables, size variables, and company variables in the car class.
There is a separate name for the variables used within the class. The name is property.
Then we'll make the wheel, door, color, size, and company properties. Wheels means wheels, doors means doors.

  1. <?php
  2. class Car
  3. {
  4. $wheels = 4;
  5. $doors = 4
  6. $color;
  7. $size;
  8. $company;
  9. }
  10. ?>

I created a property. When declaring properties and functions in a class, you specify the access limiter first. Next, we will look at access modifiers.