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: 

inheritance

Former Member
0 Kudos

When should inheritance be used in ooabap?

6 REPLIES 6

Former Member
0 Kudos

This message was moderated.

0 Kudos

Hey Naresh,

You copied and pasted one my posts on the subject with no acknowledgement!!

Edited by: Sougata Chatterjee on Dec 24, 2007 12:33 AM

Added URL

matt
Active Contributor
0 Kudos

Not the first time either:

[;

matt

Former Member
0 Kudos

Hi,

Inheritence should be used when dealing with related objects of the same category...for e.g. it makes sense for a class of 'Cars' to inherit from a class named 'Vehicle' becuase a car is a type of vehicle. As the word 'inherit' mean"to receive as if by succession from predecessors", so when you make a class inherit its parent class (or its SuperClass) it receives, in this case, all the properties (Methods/Events) and Attributes (Public and Protected data, constants etc.) of its superclass and the class itself is then known as a SubClass...so in short, Class "Vehicle" can be a superclass of the Class "Car" if car inherits vehicle (makes sense to do so).

See example of inheritance below from the book "ABAP Objects" by Horst Keller. I recommend you create this program in your system and run it in debugging mode to understand the concept of inheritance. Note - class "object" is the parent or root Class of all classes, that is to say all classes automatically inherit 'object' class therefore the statement

CLASS vehicle DEFINITION INHERITING FROM object.

Kindly Award Points If You Find The Reply Helpful.

Cheers,

Chaitanya.

matt
Active Contributor
0 Kudos

Chaitanya, you do realise that what you've posted is word for word identical to that already posted in this very thread by Naresh, who copied it without acknowledgement from Sougata Chatterjee

matt

marcelo_ramos
Active Contributor
0 Kudos

I think this situation is becoming so routine that it no longer surprises me more:

- User_1 forgets search for the 9 questions cited by other users and creates the tenth topic with the same title 'inheritance';

- User_2 Thinking only in get points he performs a search that User_1 forgotten to make and copies of the 9 answers found.

- User_3 The user who kindly devoted part of his time to answer one of 9 topics without forgetting the magic phrase '[Don't forget to reward points and good luck with ABAP Objects.|;' calls for his copyrights.

- User_4 To raise no suspicions copies only part of the response of user_2, perhaps because he think the One Million Members of the SDN are donkeys and will not understand what is happening !

Maybe some people should read carefully the contents of the link below [' Rules of Engagement'|https://wiki.sdn.sap.com/wiki/x/FgQ]

Perhaps these rules are not clear to everyone then I suggest to some that accompany these types of topics and understand once and for all that 'WE ARE MINDFUL FOR THIS TYPE OF DISHONESTY '

- [Point hunters|;

- [Some more point hunters?|;

- [User is flooding forum with irrelevent questions|;

- Sachdev Soman, DON'T OPEN DUPLICATED THREAD, close all your thread ( You have 4 open thread ) and reward point only for correct answer !

- Naresh and Chaitanya Raju, If you do not know the correct answer did not reply ! Do as the good users, just watch to learn ! And never use phrases like "Kindly Award Points If You Find The Reply Helpful." or "Reward if usefull" or "Don't forget to reward points and good luck with ABAP Objects.".

I hope that some people have learned !

Marcelo Ramos