TAW_12 Chapter 9, OO design patterns Flashcards

1
Q

An ABSTRACT class or method has definition and implementation cannot be…

A

Instantiated

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

Can a Static method be abstarct?

A

No, static methods cannot be redefined

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

Both Classes and Methods can be _____ to prevent redefinition or inheritance

A

FINAL

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

Can an ABSTRACT class be FINAL

A

Yes, but it should only contain static components

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

How can a table of references be read using their public attributes?

A

table_line->fld = fld2

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

SAP recommends limiting public attributes to what?

A

Read-only mode

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

What does the addition table_line provide

A

Access to public attributes of the internal table object reference

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

In the statement lcl_class = NEW what can be?

A

Either the super or subclass of the ref defined in the data statement

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

Check this out!
data lcl_alv type ref to cl_gui_alv_grid.

lcl_alv = NEW #( i_parent = NEW cl_gui_custom_contatiner( conatiner_name = ‘CONTAINER_1’ ) )

A

Whoa! objects on the fly!!

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

IS INSTANCE OF

A

Will determine if the object is type of the class or its subclasses

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

CASE TYPE OF doe what?

A
Checks if the object is of a class type.  The when can be combined with an into
CASE TYPE OF CL_CAR.
When type cl_suv INTO lcl_suv
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Where does CREATE PRIVATE get declared and what does it mean?

A

At the Class Definition. It means an object can only be created within the class itself. Usually in a private static method of the class.

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

What are the advantages of a factory method

A
It can handle a lot of coding (locks, auth checks, prereq code) without burdening the programmer
Multiple factory methods can exist for one class 
A factory method can choose to implement a suitable subclass if needed
A factory method can be managed by the class itself to prevent duplication (a group of singleton)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

One way to create a singleton is

A
Create PRIVATE
public section
class-method get_instance returning 
value(the_instance)
private section
data: keep_instance type ref to this_class)
method get_instance
if the_instance is initial.
   keep_instance = new #(this_class).
endif.
this_instance = keep_instance
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

When a class declares a friendship, does it automatically become friends with the friend’s friends?

A

No

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

Is a friend of a super class also a friend of the sub classes?

A

No

17
Q

In persistent objects the database access is performed by?

A

The class actor

18
Q

Can a tcode be linked to a public method of a class?

A

Yes, but the constructor cannot have importing parameters