s3a
March 24th, 2010, 07:35 PM
My teacher gave us a practice test and I would just like to know why the answer is (b) to the following question:
Any new class you create from an existing class is called a(n)
(a) base class (b) derived class (c) superclass (d) extended class.
I had chosen (d) but I knew it had to be between (b) and (d). I would appreciate it if someone could explain this in a bit more detail so that I can understand the answer rather than just memorize it.
Any input would be greatly appreciated!
Thanks in advance!
dlorde
March 25th, 2010, 05:10 AM
a, c, and d are synonymous, although d is semantically ambiguous to many people. An 'extended' class is, strictly, a class that has been extended, so if class A is extended to make class B, class A is the extended class, and class B the extension. However, you could also claim that class B is an extended form of class A, so class B could be called the extended class - this is a type of grammatical confusion that seems increasingly common.
A derived class is a class is derivative; it is based on another class, it extends another class, it is a subclass.
When a programming language is created that allows programmers to program in simple English, it will be discovered that programmers cannot speak English...
Anon.
nuzzle
March 26th, 2010, 02:08 AM
I had chosen (d) but I knew it had to be between (b) and (d). I would appreciate it if someone could explain this in a bit more detail so that I can understand the answer rather than just memorize it.
The Java terminology is pretty clear (as established in the Java Programming Language by Gosling and others).
The base class/derived class pair is avoided (it's C++ terminology). Instead the superclass/subclass pair is preferred. Furthermore, an extended class is a subclass.
So in a strict Java sense the correct answer is (d). In a wider sense (b) is also correct.
jitechno
March 27th, 2010, 09:21 AM
This is a kind of questions from eggheads :-)
How answer to this question will help to create perfect code?