TAW_12 Chapter 3, Inheritance and casting Flashcards

1
Q

How many super classes can a class have?

A

A class may only inherit from one super class, but that super class may have inherited from a super class as well

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Can signatures be changed when redefining a method?

A

No

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

When redefining a method should I specify a signature?

A

No, because the signature is inherited from the super class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

If when redefining a method I just want to add code rather than replace it, how can I call the super class method in my redefinition?

A

super->method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Can a constructor be redefined?

A

No, you don’t need to do that because you can create a constructor independent of the super class constructor. It can have it’s own signature. YOU MUST CALL the SUPER->CONSTRUCTOR as part of your new instance constructor. You may need to find the previous super class signature to make sure you supply the parameters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What symbol is used in UML to denote Protected?

A

#

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Protected components are visible…?

A

In the class and all subclasses

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How can a subclass access private attributes of the superclass?

A

Using public or protected methods of the superclass

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Can a subclass have its own class-constructor?

A

Yes, and it does not need to call the super-class class-constructor as that is called automatically

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the downcast syntax?

A

?=

How well did you know this?
1
Not at all
2
3
4
5
Perfectly