© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2021
I. WatersPowerShell for Beginnershttps://doi.org/10.1007/978-1-4842-7064-6_8

8. Classes

Ian Waters1  
(1)
Bexhill, UK
 

A class is another great way to group together code that serves the same purpose, and is used to specify your own objects, which can then be used to save lots of information and passed around as a single object via a variable.

A good example of this is a “Person.” A person has multiple properties associated with them. For example, a person has a name, age, height, hair color, favorite colors, and shoe size, to name a few. If you need to create an object that has lots of properties, a class is the best way to group this information together.

Get PowerShell for Beginners: Learn PowerShell 7 Through Hands-On Mini Games now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.