ShmoopTube
Where Monty Python meets your 10th grade teacher.
Search Thousands of Shmoop Videos
Computer Science Videos 112 videos
Just as you move your furniture into a new house before spending the night, you’ve got to spend a little time setting up your environment when yo...
Doubles and ints. At first glance, it may look like this video will be about baseball and football statistics. But they're actually computer scienc...
AP Computer Science: Classes and Objects Drill 1, Problem 1. Which of the following is a correct {/* Implementation */} for the isInsect method?
AP Computer Science 1.5 Inheritance, Abstraction, and Polymorphism 188 Views
Share It!
Description:
AP Computer Science 1.5 Inheritance, Abstraction, and Polymorphism. Which of the following implementations of the Dinghyprint function will have the desired effect?
Transcript
- 00:00
Thank you We sneak and here's your smoke too Sure
- 00:05
which was supposed to be brought to you by boats
- 00:08
but that ship has sailed Consider the following classes i
- 00:16
publicly all right the dinghy print function should print all
- 00:21
relevant information about a dinghy object Which of the following
Full Transcript
- 00:26
implementations of the dinghy print function will have the desired
- 00:30
effect All right And here your potential answers Okay well
- 00:36
choice one seems like a valid choice It uses sailboats
- 00:39
print method and then prints out the crew size Choice
- 00:42
Two seems ok at first glance too but if we
- 00:44
take a closer look we can see some majorly wrong
- 00:47
code dinghy attempts to access the variables my name and
- 00:51
holing directly This is illegal both those data fields or
- 00:56
private Nothing can access them directly except the class They're
- 00:59
in a very exclusive club Lastly let's take a look
- 01:02
at our third choice This time it gets the variables
- 01:05
my name and holing using getters Well this is the
- 01:12
only way you can access private variable so choice Three
- 01:15
adheres to java rules It seems like choices One and
- 01:18
three are answers That leaves us Is option d being
- 01:22
the correct answer We hope you'll tune in next time 00:01:25.066 --> [endTime] for some more fun
Related Videos
AP Computer Science 1.2 GridWorld Case Study and APIs. What is the direction of the actor?
AP Computer Science 1.4 Standard Algorithms. How many times will mystery be called for mystery(n) for n > 1?
AP Computer Science 2.3 Classes and Objects. Which of the following is correct implementation of the Country class?
AP Computer Science 3.4 Inheritance, Abstraction, and Polymorphism. Which of the following will satisfy the conditional if statement for boo, str,...
AP Computer Science 4.2 Standard Algorithms. What kind of algorithm is the following?