ShmoopTube
Where Monty Python meets your 10th grade teacher.
Search Thousands of Shmoop Videos
Program correctness Videos 9 videos
AP Computer Science: Classes and Objects Drill 2, Problem 4. Which of the following is not a legal method call?
AP Computer Science 2.2 Classes and Objects. Which of the following method declarations is correct?
APCS: Inheritance, Abstraction, and Polymorphism Drill 1, Problem 2. Which of the following is the correct way to begin writing your class?
AP Computer Science 1.3 Program Development 308 Views
Share It!
Description:
AP Computer Science 1.3 Program Development. Which of the following is a correct declaration of one of the classes in the diagram?
Transcript
- 00:00
Thank you We sneak and here's your smoke du jour
- 00:05
Brought to you by inheritance relationships Why yes wealthy old
- 00:09
lady We'd love to help you paint mr grumbles now
- 00:12
All right this question is based on the following class
- 00:14
Higher every diagram no an open air Oh denotes an
Full Transcript
- 00:17
inheritance relationship and a closed arrow to notes a composition
- 00:22
relationship So which of the following is a correct declaration
- 00:26
of one of the classes in the diagram Alright we'll
- 00:30
hear your potential answers Freedom freedom Think All right So
- 00:33
this question is about inheritance and composition relationship which could
- 00:37
be more easily thought of as is and has a
- 00:41
relationship But look at the diagram again Closed down arrows
- 00:45
show inheritance or is a relationship North american country is
- 00:49
a country Asian country is a country european Well these
- 00:55
classes are just more specific versions of the class they're
- 00:59
inheriting from then we have composition or has a relationship
- 01:03
represented by the up Arrow state has a north american
- 01:08
country It belongs to province and territory do too Okay
- 01:13
So back to the question at hand Which of the
- 01:15
potential answers is a correct declaration of the goings on
- 01:18
In a diagram well option a declares north american country
- 01:21
as an independent class Nice try jefferson but we're not
- 01:24
talking about the tyranny of king george We need to
- 01:27
declare north american country as a subclass of country if
- 01:31
we're following the diagram option b says state extends or
- 01:35
inherits from country which isn't correct according to the diagram
- 01:39
In fact it's outright saying that state is a country
- 01:42
and well known on it all our option c has
- 01:46
east asian country extends from asian country which is absolutely
- 01:50
true East asian country is an asian country d says
- 01:55
territory extends from north american country territory is a north
- 02:01
american country and e country extends from north american country
- 02:07
Not even soc is definitely our answer Anyone seen the
- 02:10
nail polish remover No i
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?