Chapter 11 - Abstract data types Flashcards
what is an abstraction?
a view or representation of an entity that includes only the most significant attributes
what is an abstract data type?
- a data representation of one specific data type
- the subprograms that provide the operations for that type
6 Design issues for abstract data types
- what is the form of the container
- what types can be abstract
- can abstract types be parameterized
- what access controls are provided
- is the specification of the type physically separate from its implementation
- should general built-in operations be provided from objects of abstract data types
What is an object
an instance of an abstract data type
What is the encapsulation construct in Ada
the package
4 characteristics of C++ class
- an encapsulation device
- all class instances share a single copy of the member functions
- each instance of a class has its own copy of the class data members
- instances can be static, stack dynamic, or heap dynamic
6 characteristics of C++ constructors
- they initialize objects
- may allocate storage for any parts that are heap-dynamic
- can include parameters to provide parameterization of the objects
- implicitly called when an instance is created
- can be explicitly called
- name the same as class
5 characteristics of C++ destructors
- implicitly called when the lifetime of an instance of the class ends
- often used for delete of heap-dynamic data allocated within the class
- often used for debugging or statistical analysis
- can be explicitly called
- the name is ~class_name
3 differences of Java objects than C++ objects
- all objects are allocated on the heap and accessed through reference variables
- individual entities in classes have access modifiers (public, private) rather than clauses
- has an extra scoping mechanism “package scope” to be used in place of friends
3 characteristics of abstract data types in C#
- all class instances are heap dynamic
- default constructors are predefined for all classes
- C# allows destructors but it uses garbage collection so they are rarely used
6 characteristics of C# structs
- they can have constructors, properties, methods, and data fields
- can implement interfaces but do not support inheritance
- they are value types (their data is allocated to memory on the stack)
- they default to pass by value when used as parameters
- they can be declared like other types
- they can also be created using new operator with invokes the constructor
3 characteristics of Ruby classes (that I probably don’t know)
class methods are distinguished from instance methods by having a class name appended to the beginning of their names with a dot separator
constructors are called “initialize”
classes can be “updated” any place in the text
Ruby undef_method vs remove_method
undef_method - blocks any reference to a given method
remove_method - block deletes method from class but allows those class objects to look for method definition in parent
4 characteristics of information hiding in Ruby
- access control violations are only detected at runtime
- uses public (default), protected, and private
- all data members of a class are private and cannot be changed
- data access is via methods only
what is an encapsulation construct?
-a way of organizing programs into collections of logically related code and data, each of which can be compiled without recompilation of the rest of the program