520 Chapter 11 Abstract Data Types and Encapsulation Constructs
- What is a friend function? What is a friend class?
- What is one reason Java does not have friend functions or friend classes?
- Describe the fundamental differences between C# structs and its classes.
- How is a struct object in C# created?
- Explain the three reasons accessors to private types are better than mak-
ing the types public. - What are the differences between a C++ struct and a C# struct?
- Why does Java not need a use clause, such as in Ada?
- What is the name of all Ruby constructors?
- What is the fundamental difference between the classes of Ruby and
those of C++ and Java? - How are instances of Ada generic classes created?
- How are instances of C++ template classes created?
- Describe the two problems that appear in the construction of large pro-
grams that led to the development of encapsulation constructs. - What problems can occur using C to define abstract data types?
- What is a C++ namespace, and what is its purpose?
- What is a Java package, and what is its purpose?
- Describe a .NET assembly.
- What elements can appear in a Ruby module?
PROBLEM SET
- Some software engineers believe that all imported entities should be
qualified by the name of the exporting program unit. Do you agree?
Support your answer. - Suppose someone designed a stack abstract data type in which the func-
tion top returned an access path (or pointer) rather than returning a
copy of the top element. This is not a true data abstraction. Why? Give
an example that illustrates the problem. - Write an analysis of the similarities of and differences between Java pack-
ages and C++ namespaces. - What are the disadvantages of designing an abstract data type to be a
pointer? - Why must the structure of nonpointer abstract data types be given in
Ada package specifications? - Discuss the advantages of C# properties, relative to writing accessor
methods in C++ or Java.