Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

"When you redefine a method, you cannot change its visibility (PUBLIC, PROTECTED)"

Former Member
0 Kudos
1,095

Dear experts,

I support an application on SAP BW 7.31 - after migrating form 7.0 to 7.31 we get this error.

In the debugger I came to an instantiation of the object of type ZCLASS  wich fails with the error above.

               Create object obj_ref...

The class ZCLASS is a subclass of  CL_RSSH_HIERARCHY_BASE.

I seems to me SAP changed something in the base class wich affects our  subclass now.

Can someone give a hint?

What does the error in general mean?

Thanx in advance

yk

3 REPLIES 3

Former Member
0 Kudos
245

Redefining a method means that you create you own implementation to the original one.

When doing so you can't change it's visibility, meaning you can't change it from public to protected or private.

Former Member
0 Kudos
245

Bernd,

Redefining is used when you use inheritance. The concept of inheritance allows you to define you own logic for a method but you cannot change the visibility of variables used in the methods.

This way you can define 2 objects, one of which refers to the parent and the other to the child class. When you call the method of the parent class, you can execute a different logic and when you execute the method of the child class you will use a different logic (if redefined).

Thanks,

Vikram.M

rahul_mb
Active Participant
0 Kudos
245

Hi Bernd,

Please compare the visibility of all the methods of the standard class CL_RSSH_HIERARCHY_BASE and the custom class ZCLASS. The visibility of the methods which are re-defined in ZCLASS should be exaclty same as in the standard class CL_RSSH_HIERARCHY_BASE.

Regards,

Rahul MB