bab 11

29 Jun

1. What are the two kinds of abstractions in programming languages?
process abstraction and data abstraction

2. Define abstract data type.
a data structure, in the form of a record, but which includes subprograms that
manipulate its data

3. What are the advantages of the two parts of the definition of abstract data type?
The advantage of having the implementation of
the type and its operations in different syntactic units is that it increases the
program’s modularity and it is a clear separation of design and implementation.

4. What are the language design requirements for a language that supports abstract
data types?
object oriented program language design

10. What is the use of the Ada with clause?
11. What is the use of the Ada use clause?
The with clause makes the names defined in external packages
visible; in this case Ada.Text_IO, which provides functions for input and
output of text. The use clause eliminates the need for explicit qualification
of the references to entities from the named package.

13. From where are C++ objects allocated?

15. What is the purpose of a C++ constructor?
to allocate memories for object.

25. From where are Java class instances allocated?

26. Why does Java not have destructors?
because java has its own built in garbage collecting program.

30. What is a friend function? What is a friend class?
function with keyword friend, which can be access from friend class
class with keyword class.

34. Explain the three reasons accessors to private types are better than making
the types public.
-can only be accessed from its own class

problem set

12. Why are destructors rarely used in Java but essential in C++?
because java has its own built in garbage collecting program.
and C++ doesn’t have any built in garbage collecting program, so destructors
serve as garbage collecting program.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: