9.4 Summary

We described how to create objects and methods. The special method initialize was discussed as the means to implement a constructor. Also, class variables were described.

9.4.1 Key Concepts

  • Objects are created by instantiation. This is done via the constructor contained in the class definition.

  • When creating a class, it is important to keep in mind that objects from the class are meant to group data and methods together.

  • A key point to keep in mind when working with objects is that once an object has been created, it abstracts the details away from the program that uses it. In other words, you can use an object without seeing the details of that object directly.

9.4.2 Key Definitions

  • Instantiating objects from classes: The creation of new objects.

  • Constructor: A special method that all classes have that initializes the data in an object each time a new object is created.

  • Instance variable: A variable that is unique to an instance of a class. It stores information relevant to the object.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.15.100