1 00:00:00,940 --> 00:00:05,122 Once we create an object, we can access its properties. 2 00:00:05,122 --> 00:00:11,220 We reference the object name, followed by the characters dash and 3 00:00:11,220 --> 00:00:14,540 greater than, which together make a single arrow. 4 00:00:14,540 --> 00:00:16,260 And finally, the property name. 5 00:00:18,610 --> 00:00:22,630 Note that the property name does not start with the dollar sign. 6 00:00:22,630 --> 00:00:26,110 Only the object name starts with the dollar sign, 7 00:00:26,110 --> 00:00:29,930 because this entire reference is one variable. 8 00:00:29,930 --> 00:00:31,950 Because multiple instances or 9 00:00:31,950 --> 00:00:37,230 objects of a class can exist if the individual object is not referenced, 10 00:00:37,230 --> 00:00:41,240 the script would be unable to determine which object to read from. 11 00:00:42,310 --> 00:00:47,330 We can then interact with this property just like we would any other variable. 12 00:00:47,330 --> 00:00:50,641 To display this property, we can type echo before it. 13 00:00:52,195 --> 00:00:55,331 To set the property, we use the object. 14 00:00:57,997 --> 00:01:04,620 The single arrow, the property name, the equal sign, and then our value. 15 00:01:09,920 --> 00:01:11,533 Let's print this property again. 16 00:01:17,854 --> 00:01:20,105 Now let's check this out in our console. 17 00:01:24,567 --> 00:01:28,238 We now see Alena Holligan, Grandma Holligan. 18 00:01:28,238 --> 00:01:31,290 The power of OOP becomes apparent 19 00:01:31,290 --> 00:01:35,060 when using multiple instances of the same class. 20 00:01:35,060 --> 00:01:40,830 More than one object can be built from the same class at the same time, 21 00:01:40,830 --> 00:01:44,180 each one independent of the others. 22 00:01:44,180 --> 00:01:45,770 Let's create a second object. 23 00:01:47,718 --> 00:01:49,500 We'll name this recipe2. 24 00:01:55,654 --> 00:01:59,025 We can then set the source for recipe2. 25 00:02:06,355 --> 00:02:10,333 Now let's print the source for both recipe1 and recipe2. 26 00:02:21,214 --> 00:02:23,360 Now let's run the script in the console. 27 00:02:25,655 --> 00:02:31,710 $recipe1->source was first initialized with the default value Alena Holligan. 28 00:02:31,710 --> 00:02:35,410 We then changed that value to Grandma Holligan. 29 00:02:35,410 --> 00:02:40,850 Then we created a second recipe and set its source to Betty Crocker. 30 00:02:40,850 --> 00:02:48,140 This had no effect on recipe1, because recipe1 and recipe2 are separate entities. 31 00:02:48,140 --> 00:02:48,970 This makes for 32 00:02:48,970 --> 00:02:53,760 easy separation of different pieces of code into small related bundles. 33 00:02:54,870 --> 00:02:55,760 Great job. 34 00:02:55,760 --> 00:03:00,850 We set up our recipe class to contain all the properties of a recipe object, and 35 00:03:00,850 --> 00:03:04,960 we demonstrated how we can create individual objects that exist 36 00:03:04,960 --> 00:03:10,490 independently of other objects and can have their own property values. 37 00:03:10,490 --> 00:03:13,970 Next, we want to set up the actions our object will perform.