‎2009 May 28 7:02 AM
Hi,
Situation :
A class with local type defined (by adding code after clicking local types button in se24 - class builder, but NOT in either public or private or protected sections) . This class has private data member of that defined type and also has a public method using that private member. This class is activated and has no problems.
Created a subclass, inheriting the above mentioned class.
Problem :
When I do syntax check or try to activate the created subclass , I get syntax error saying - type unknown in parent class.
Whereas if type definition is coded in either public or private or protected section of parent class then its subclass can be activated with no errors.
Do any know :
The reason for syntax error ?
Differences in defining types in place after clicking local types button in se24 and that of defining types in either public or private or protected sections of the
in se24 - class builder, but NOT in either public or private or protected sections) . This class has private data member of that .
‎2009 May 28 7:31 AM
Hi,
as u said that you have a public method which uses private member of the parent class... now when you inherit the parent class to a subclass then the private member will not be inherited due to which it will not be visible to the subclass.....
private members or private methods are never inherited...
you will have to make that private member as a protected member if you want it to be inherited to its subclass....
Hope I am able to answer your query...
Regards,
Siddarth
‎2009 May 28 7:31 AM
Hi,
as u said that you have a public method which uses private member of the parent class... now when you inherit the parent class to a subclass then the private member will not be inherited due to which it will not be visible to the subclass.....
private members or private methods are never inherited...
you will have to make that private member as a protected member if you want it to be inherited to its subclass....
Hope I am able to answer your query...
Regards,
Siddarth
‎2009 May 29 9:46 AM
ABAP Objects there types of visibility areas: Private: Visible only to myself Protected: Visible to myself and my descendants Public: Visible to everyone If a method is private you can only.Local objects are not inherited,in other hand, the 3 sections public, private and protected inherited,when you inherit the parent class to a subclass then the private member will not be inherited due to which it will not be visible to the subclass,private members or private methods are never inherited,you will have to make that private member as a protected member if you want it to be inherited to its subclass.