Concepts of Programming Languages

(Sean Pound) #1

520 Chapter 11 Abstract Data Types and Encapsulation Constructs



  1. What is a friend function? What is a friend class?

  2. What is one reason Java does not have friend functions or friend classes?

  3. Describe the fundamental differences between C# structs and its classes.

  4. How is a struct object in C# created?

  5. Explain the three reasons accessors to private types are better than mak-
    ing the types public.

  6. What are the differences between a C++ struct and a C# struct?

  7. Why does Java not need a use clause, such as in Ada?

  8. What is the name of all Ruby constructors?

  9. What is the fundamental difference between the classes of Ruby and
    those of C++ and Java?

  10. How are instances of Ada generic classes created?

  11. How are instances of C++ template classes created?

  12. Describe the two problems that appear in the construction of large pro-
    grams that led to the development of encapsulation constructs.

  13. What problems can occur using C to define abstract data types?

  14. What is a C++ namespace, and what is its purpose?

  15. What is a Java package, and what is its purpose?

  16. Describe a .NET assembly.

  17. What elements can appear in a Ruby module?


PROBLEM SET



  1. 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.

  2. 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.

  3. Write an analysis of the similarities of and differences between Java pack-
    ages and C++ namespaces.

  4. What are the disadvantages of designing an abstract data type to be a
    pointer?

  5. Why must the structure of nonpointer abstract data types be given in
    Ada package specifications?

  6. Discuss the advantages of C# properties, relative to writing accessor
    methods in C++ or Java.

Free download pdf