Class Construction Conclusion
This module discussed how to create compound data types from smaller types using classes.
You learned that classes are user-defined data types, and that objects are instances of those classes.
You simply create objects of your existing class inside the new class.
This is called composition because the new class is composed of objects of existing classes.
In general, there may be zero, one, or more instances of any given class. Classes have attributes, and objects provide particular values for each attribute.
You also learned how to represent classes, objects, and their attributes in Unified Modeling Language (UML)-style diagrams, and how to draw a
diagram that represents the relationships among classes.
This module introduced you to the following terms:
- Anonymous object
- Class diagram
- Composition over inheritance:Composition over inheritance (or composite reuse principle) in object-oriented programming is the principle
that classes should achieve polymorphic behavior and code reuse by their composition (by containing instances of other classes that implement the desired functionality)
rather than inheritance from a base or parent class
- Member variable: In object-oriented programming, a member variable (sometimes called a member field)
is a variable that is associated with a specific object, and accessible for all its methods (member functions).
- Object diagram:
The next module will discuss the characteristics of operations and methods in classes and how to diagram them.
UserDefined Data Types - Quiz