Objects, Properties and Methods Part 1
The use of Objects is probably one of the most confusing parts of Powershell. By using illustrations or word pictures we hope to clarify PowerShells use of objects. If you have never programmed or scripted with objects, it’s critical that you gain an understanding of objects. If you are experienced and comfortable with the concept of objects you can skip this section.
Objects
The Boat
-
- So what are objects? Objects are things that we can interact with. For example: Like a boat or a car. Technically an object is the programmatic representation of anything.
-
An object is a cmdlet created by a developer.
-
- So why use a boat to illustrate an object? Because a boat is something that we have all seen and we all understand.
-
- Objects are usually considered as two types of things, Properties and Methods.
-
- Let’s take a look at some of these properties of our boat.
-
- Properties describe features, so let’s checkout some of these features.
-
- There’s our spot light , life preserver , COMS device , windows, and our engine.
-
- Now l et’s take a look at Methods. Methods describe actions or in this example things that we can do with our boat.
-
- Like Turn on the light , Throw the life preserver, track ships with our communication device, clean the windows and start the engine.
-
- Here’s another way to show properties and methods.
The Car – Let’s take a look at another example.
-
- We already said that an object can be a car.
-
- And that Objects consist of Properties and Methods.
Properties describe the features of an object
Let’s take a look at some of the features of our car
Like headlights, wheels, side mirrors, our steering wheel, spoiler, and the door handle.
-
- Methods describe actions or things that we can do with our car
-
- Like turn-on lights , add air…
No comments yet. Add the first comment to start the discussion.