@object4182780719 you’re welcome
so brilliant explaination. thank u so much
@extraordinaryalexia6 you’re welcome
Thanks, this simple explanation broke it down for me.
wow! thank you so much for this explanation
I love your explaination!!! so clearly and easy to understand in my real life experience.
this really helped me out. this is the power of internet!
Hi, best explanation for me
But, can I say that Instance are some kind of sub-type of data types? I mean, there’s a way I can imagine in my mind. you talk about:
@joseulisesjuarezparr saying “sub-type” may be a bit confusing, I prefer to say something like : “Jose” can be CLASSIFIED under string data type. But let me just give an example to further explain,
Let us say we have an Aeroplanes object and a cars object.
Instances of the Aeroplanes object include: Airbus A320 , Boeing 737- max.
Now the vehicles which are classified as Aeroplanes are instances of the Aeroplane object and therefore have properties and methods of the Aeroplane object.
some of the properties could be:
wingLength, numberOfEngines, seatingCapacity.
some of the methods could be:
takeOff( ), land( ), elevate( )
This means that any vehicle classified as an aeroplane would have these properties and would perform this functions or methods.
Instances of the cars object include: Toyata Camry and Kia Cerato.
some properties could be:
sizeOfBonnet, sizeOfTrunk, seatingCapacity, color, fourWheeldrive etc
some methods could be:
drift( ) ,start( ), park ( ), accelerate ( ), reverse( ), overtake( ) etc
This means that any vehicle classified as a car will have these properties and methods.
Now relating this to programming.
This means we can use a property like .length on a string and a method like .split( ).
When we type 19 it is classified as a number and thus is an instance of the Number data type. This means that it would have properties and methods of the Number object.
It is important to know what data type you are working with so we know the right properties and methods to use.
Just like it would be crazy for a pilot to try to .drift( ) with a boeing 737-max or a driver try to do .takeoff( ) with a car, because only instances of cars can drift and only instances of aeroplanes can fly.
This would be like using .length and .split( ) on a Number data type when they should be used for a string data type
I hope this clarifies any confusion
Thank you very much!! for taking the time to write your answer in such detail. Everything is much clearer to me.
Again, thank you very much.
you’re welcome, happy coding.
You will be a good teacher
6 posts were split to a new topic: Link is not working