So if this were a real intake program at a vet, and the user could only input weight and color for example. Would we just be making up all of these other values we are initializing? I thought we were making several initialization methods to cover the types of intake scenarios for a cat, but I don't understand why we are still inputting data that wouldn't be available?
question about this concept
Under discussion
Comments (1)
- Popular
- New
- Old
You must be signed in to leave a comment
MoJo
30 August 2020, 19:51
To create an object we have to assing a value to all the variables provided by the class of the object. Even if we create an object without providing any values to the variables, the program still assings some. Note that "Null" is also a value. The program needs data to work with otherwise it will not accept the object.
That is the difference between a class and an object. The class got the variables but the object, which is an instance of a class, needs values to these variables. An object also needs a unique name (identifier). You can find out more by googeling classdiagrams or "obects and classes".
0