21.03.2013 Views

Object Oriented ABAP

Object Oriented ABAP

Object Oriented ABAP

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Redefining methods in subclass<br />

Definition: The methods of the super class can be re-implemented at the sub class.<br />

Purpose to redefine methods: if the method implementation at the super class is not<br />

satisfies the requirement of the object which is created with reference to the sub class.<br />

Principles of redefining methods:<br />

1. The REDEFINITION statement for the inherited method must be in the same<br />

SECTION as the definition of the original method.<br />

2. If you redefine a method, you do not need to enter its interface again in the<br />

subclass, but only the name of the method.<br />

3. In the case of redefined methods, changing the interface (overloading) is not<br />

permitted; exception: Overloading is possible with the constructor<br />

4. Within the redefined method, you can access components of the direct super class<br />

using the SUPER reference.<br />

5. The pseudo-reference super can only be used in redefined methods.<br />

Demo program for redefining method:<br />

Go to transaction SE38:<br />

Give any name for the program.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!