TAW_12 Chapter 4, Interfaces and casting Flashcards
What section do all interface components belong too
Public
True or false, interfaces closely resemble super classes
True
What do interfaces primarily serve to define?
Uniform interface protocols
In UML, how are interfaces noted?
<> and a dotted line
How are interface components addressed?
~
Full access would be
->~
Aliases can be defined for a complete ineterface?
No, only by component?
Because interfaces must be implemented in the public section, all aliases must also be implemented at the public level?
No, you can define an alias in protected or private
How can an alias be defined?
ALIASES new_name
FOR ~
Class A uses interface B. Can I upcast an object of type A to a ref variable of class B?
Yes, that’s the whole point. At that you no longer need to use the instance syntax of ~
Describe using n interface reference?
DATA: lo_part type ref to if_part
Loop at some_table into lo_part. “populates the ref
lo_part->display_name( ). “lo_part is just a template
What is the main strength of interafces?
Poymorphism
What are the two downcast operators?
TARGET ?= SOURCE
or
MOVE SOURCE ?TO TARGET
To prevent casting errors, what catch should be used in the try block?
cx_sy_move_cast_error
RTTI Class services can also be used
What happens if I extend a interface with a new method?
All classes using the interface must implement the new method
Can an interface include other interfaces?
Yes