+ 3
Defining and classifying objects
I see this in a lot of codes. I don't get it. What is the difference between defining and classifying objects, and what does that do? Also, is there a difference in what it does and what can it can do between different coding languages?
5 Réponses
+ 1
+ 1
thank you, you really helped me out :)
0
Never heard of classifying objects, so I'm waiting with you.
0
Objects in python and c# is different from objects in JavaScript.
In JavaScript an object is like associative arrays of c# or dictionaries in python.
In C#, an object is like class instance in javascript.
So which language are you talking about?
0
In python if you have a class Gun as defined
class Country:
def __init__(self, name):
self.name = name
You can define a Country object as thus
my_country = Country("Nigeria");
Note how the self attribute was skipped. Python automatically adds it for you
You can classify objects of a class by putting them inside a list as thus
their_country = Country('United States')
countries = [my_country, their_country]