0
Properties
I tried to read through the internet on why I need properties and I just don't understand when I use them and which benefit it gives me? If anyone could explain it to me I would be very grateful.
5 Answers
+ 5
Greetings friend!
There are three principles of Object-oriented programming: encapsulation, inheritance and polymorphism.
When you are creating objects you have to make attributes of this object private for making your app safety. So you use encapsulation. But for accessing them you should use public functions(methods) called getters and setters. So it will be useful if u work with attributes.
Happy Coding! đ
+ 2
why do you need properties?image you had no name,no property,and you were 100% like every other human on earth,how would identify you.Same thing,properties define an objects attributes,what makes it different from other objects
+ 1
The main idea is use private attributes(class variables) and public functions(class methods).
But if u make ur attitudes private u can't access to data so u have to use public functions.
+ 1
You are not dumb because you do ask questions, That is a smart thing to do.
So what is you current knowledge at this moment.
Did you make a class ? (a car-class or a person-class)
Did you create a object of that class ?
- 1
Thank you guys for your answers. I don't know if I am dump but I still don't get it :(