What is property? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is property?

12th Oct 2018, 1:41 PM
Diako
Diako - avatar
2 Answers
+ 2
Think of it as a way for you to define and/or query some aspects of an object, for example, a car, may have the following properties: * Colour (red, green, blue etc.) * Engine capacity (in CC) * Power source (Fuel, electric) * Manufacturer (Mitsubishi, Toyota etc.) And some other properties you can think of to distinguish a certain car from others. In programming, properties are used to encapsulate values, so that access and modification to these values can be validated and organized, properties are also well known as getters and/or setters. Properties can be designed as read-only, write-only, or read and write, depending on the design. Read-only properties only returns the property value, write-only properties only allows to change the value, read write means we can do both. P.S. Next time please indicate a specific language in the "Relevant tags" part of your question, it helps others to narrow your question scope : )
12th Oct 2018, 4:07 PM
Ipang
+ 1
thanks
13th Oct 2018, 6:29 AM
Diako
Diako - avatar