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: 

What is inheritance

Former Member
0 Kudos

Hi gurus

can you please provide the example about inheritance

regards

sanath

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Inheritance is the Implementation relationship of the class where sub class can access the characteristics of super class.

Check this link.

http://help.sap.com/saphelp_nw70/helpdata/en/c3/225b5654f411d194a60000e8353423/frameset.htm

7 REPLIES 7

Former Member
0 Kudos

Hi,

Inheritance is the Implementation relationship of the class where sub class can access the characteristics of super class.

Check this link.

http://help.sap.com/saphelp_nw70/helpdata/en/c3/225b5654f411d194a60000e8353423/frameset.htm

Former Member
0 Kudos

Hi

<content removed by moderator as it was just a copy/paste of someone else's work without giving credit. Any points have been unassigned.>

regards

venu thaluri

Edited by: Mike Pokraka on Aug 11, 2008 9:57 AM

Former Member
0 Kudos

Hi,

if u want to access the proporties of super class in subclass then u need to use the keyword called inheriting

<content removed by moderator as it was just a copy/paste of someone else's work without giving credit. Any points have been unassigned.>

-

Raghunath.S

Edited by: Mike Pokraka on Aug 11, 2008 9:58 AM

former_member598013
Active Contributor
0 Kudos

Hi ,

Inheritance is taking the properties of the super class to the derived class.

Example:

class mammal

endclass.

class dog inheriting mammal.

so all the properties of the Mammal classs will be acquired by the dog class.

Tahnks,

Chdianand

matt
Active Contributor
0 Kudos

If you search on this forum, or read the SAP help, you'd find this: http://help.sap.com/saphelp_nw70/helpdata/en/1d/df5f57127111d3b9390000e8353423/content.htm as two previous respondants have already obviously done - but without reference.

Former Member
0 Kudos

Hi,

Super class properties applicable to Subclass once Subclass is assigned to Super class.

Regards,

Mani

Former Member
0 Kudos

Hi,

check this example in debug mode,

----


  • CLASS c1 DEFINITION

----


*

----


class c1 definition.

public section.

data : a type i,

b type i.

methods : alok.

endclass. "c1 DEFINITION

----


  • CLASS c1 IMPLEMENTATION

----


*

----


class c1 implementation.

method alok.

a = 10.

b = 15.

endmethod. "alok

endclass. "c1 IMPLEMENTATION

----


  • CLASS c2 DEFINITION

----


*

----


class c2 definition inheriting from c1.

public section.

data : c type i,

d type i.

methods : alok redefinition,

arun.

endclass. "c2 DEFINITION

----


  • CLASS c2 IMPLEMENTATION

----


*

----


class c2 implementation.

method alok.

c = 5.

call method super->alok.

d = a + b + c.

write : 'sum :', d.

endmethod. "alok

method arun.

uline.

endmethod. "arun

endclass. "c2 IMPLEMENTATION

data: count1 type ref to c2.

start-of-selection.

create object count1.

call method count1->alok.

call method count1->arun.