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.

Accessing methods using super class reference.<br />

1. By the super class reference (REF_VEHICLE) it is possible to access all the methods which<br />

are defined at the super class but the implementations are taken from the sub class.<br />

2. If any method is redefined at the sub class then that method‟s implementation which<br />

exist at the sub class is taken in to consideration.<br />

E.g. assume that „method2‟ is redefined at the sub class.<br />

When this method is accessed using the super class reference<br />

Like:<br />

Call method REF_VEHICLE->method2.<br />

Here we can access the implementation which exists at the sub class but not from the super<br />

class.<br />

3. It is not possible to access the methods which only defined in the sub class using the<br />

super class reference.<br />

E.g. Method4 is not accessed using reference REF_VEHICLE.<br />

Call method REF_VEHICLE-> Method4.<br />

This is wrong convention.<br />

Demo for narrowing casting:<br />

Go to transaction SE38.

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

Saved successfully!

Ooh no, something went wrong!