Class is like a blueprint. The necessary information (functions, etc.) is described there. The important thing here is not to use the class itself (directly in the code).
An instance of a class is an instance of the above class initialized by the "init function". (Another class) By writing (), you can access the (actual) class from that instance. And you can use the functions in the class. The instance is what you actually use in your code.
If you compare a class to something other than a blueprint, you can say that it is a "cookie-making type." What you actually eat is not the "mold" but the "cookie itself" This "cookie itself" can be expressed as an instance. Also, although there is only one type of cookie, the act of making many "cookies" using it is also possible. The same is true. If necessary, use "cookies" made from molds to "eat," "decorate," and "gift to someone you like."
Recommended Posts