In the following code, which classes can be instantiated?
abstract class Graphics {
abstract function draw($im, $col);
}
abstract class Point1 extends Graphics {
public $x, $y;
function __construct($x, $y) {
$this->x = $x;
$this->y = $y;
}
function draw($im, $col) {
ImageSetPixel($im, $this->x, $this->y, $col);
}
}
class Point2 extends Point1 { }
abstract class Point3 extends Point2 { }
Suggested Answer: A
Get Premium 200-710 Questions
as Interactive Web-Based Practice Test or PDF
Real Exam Format
Detailed Explanations
Instant Access
Get Your Practice Test
45 comments · newest first
LE
Lennie
11 months ago
Definitely, none of the abstract classes can be instantiated!
ES
Estrella
12 months ago
So, no way to create a Graphics object, right?
AB
Abel
12 months ago
Wait, can’t Point2 inherit from Point1?
ON
Oneida
1 year ago
Agreed, Point1 and Point3 are abstract.
OS
Osvaldo
1 year ago
Only Point2 can be instantiated.
MI
Micah
1 year ago
I feel like I saw a similar question before, and it was about instantiating subclasses. I think Point1 and Point2 are the only ones we can use.
IR
Ira
1 year ago
Point2 should be instantiable too, right? Since it extends Point1, which is not abstract.
BE
Bea
1 year ago
I'm not entirely sure, but I think Point1 can be instantiated since it has a concrete draw method.
LI
Linwood
1 year ago
I remember that abstract classes can't be instantiated, so I think Graphics and Point3 can't be created.
LE
Leota
1 year ago
Ah, I see now. The abstract classes can't be instantiated, but the concrete class Point2 can be. Thanks for the helpful comments, everyone. I feel more confident about this now.
GA
Gail
1 year ago
I'm a bit confused here. Since Point1 is abstract, does that mean Point2 is the only one that can be instantiated? Or are there other options?
DA
Dawne
1 year ago
Okay, let me think this through step-by-step. The Graphics class is abstract, so it can't be instantiated. Point1 is also abstract, but Point2 extends it, so Point2 can be instantiated. Point3 is abstract, so it can't be instantiated.
LE
Leslee
1 year ago
Hmm, this looks tricky. I'll need to carefully analyze the abstract and concrete classes to determine which ones can be instantiated.
KA
Kandis
1 year ago
I think I've got it! Point2 can be instantiated because it extends the concrete Point1 class. Point1 can also be instantiated since it has a constructor and a non-abstract draw() method. So the answer is B and C.
LE
Lenita
1 year ago
Hmm, I'm a bit unsure about this one. The options seem to cover a range of different networking concepts, so I'll need to make sure I understand the scope of the EFM standard specifically.
WE
Werner
1 year ago
Hmm, this seems like a tricky one. I'll need to carefully review the topology and think through the potential issues step-by-step.
LU
Luis
1 year ago
This looks like a straightforward question about the definitions of different types of contracts. I'll focus on carefully reading the question and options to identify the key differences between the two contract types.
CA
Carrol
1 year ago
This seems like a straightforward question. I'll start by reviewing the AppSource for any prebuilt solutions that could handle the currency exchange rate updates.
HY
Hyman
1 year ago
This exam is really testing our ability to abstract-ly think. I'm going to go with 'None of the Above' and just become a Hyman instead.
LE
Leontine
1 year ago
E) None, the code is invalid
CR
Cristy
1 year ago
D) Point3
CA
Carmela
1 year ago
D) Point3
ST
Stephane
1 year ago
C) Point2
SH
Sheridan
1 year ago
C) Point2
PA
Patrick
1 year ago
B) Point1
OR
Ora
1 year ago
B) Point1
KA
Katy
1 year ago
A) Graphics
ED
Edna
1 year ago
A) Graphics
NA
Nakisha
2 years ago
Haha, this question is like a game of 'Guess the Abstraction'. I'm going with D) Point3, just to keep the guessing going!
TE
Teri
1 year ago
C) Point2
HO
Hortencia
1 year ago
B) Point1
TH
Theola
1 year ago
A) Graphics
QU
Queen
2 years ago
Wait, I thought abstract classes couldn't be instantiated? E) None, the code is invalid seems like the right choice to me.
EV
Evelynn
2 years ago
Yes, you're correct. Option E) None, the code is invalid is the right choice.
MI
Michell
2 years ago
I think you're right, abstract classes cannot be instantiated.
TY
Ty
2 years ago
I think the answer is C) Point2. The Point2 class extends the non-abstract Point1 class, so it should be able to be instantiated.
RO
Rosina
2 years ago
I disagree, I think Point2 can also be instantiated since it extends Point1.
WI
Willetta
2 years ago
The correct answer is B) Point1. The Point1 class can be instantiated because it extends the abstract Graphics class and implements the required draw() method.
HI
Hildegarde
2 years ago
E) None, the code is invalid
JA
Jacinta
2 years ago
D) Point3
DE
Devon
2 years ago
C) Point2
RO
Robt
2 years ago
B) Point1
DA
Darrin
2 years ago
A) Graphics
NA
Natalya
2 years ago
I agree with Ronny, Point1 is the only class that can be instantiated because it extends Graphics.
RO
Ronny
2 years ago
I think only Point1 can be instantiated.