SAP Inheritance Interview Questions Answers

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

10/3/2014

SAP-OOABAP-Inheritance-Interview-Questions-Answers

HOME

ABAP INTERVIEW QUESTIONS

Home ENHANCEMENTS
SAP
About Us

Privacy Policy

Cross Applications

BAPI

RFC

REPORTS
Terms and Conditions

ALE IDOC

DIALOG PROGRAMMING

SCRIPTS

SMARTFORMS

BDC

Contact US

Object Oriented ABAP

Web Dynpro

Work Flow

Downloads

Your contribution can keep this blog alive!!!

SAPOOABAPInheritanceInterviewQuestions
Answers

GOOGLETRANSLATOR
Select Language
Poweredby

Translate

POPULARPOSTS
SAP Object Oriented ABAP Interview Questions
Answers

SAPABAP Inheritance Interview Questions Answers, Inheritance is the main


featureofObjectOrientedProgramminginanyObjectOrientedLanguage,like
OOABAP also contains Inheritance feature to extend the functionality of
language of SAPABAP. Here in this post we are going to provide list of
interviewquestionsandalsoanswersonInheritancetopic.Thesequestionsare
veryfrequentlyaskedbytheinterviewersintheinterviews.Clickonreadmore
toreferthispost.

SAPOOABAPInheritanceInterviewQuestionsAnswers

SAPABAP Inheritance Interview Questions Answers, Inheritance is the main feature of


Object Oriented Programming in any Object Oriented Language, like OOABAP also
containsInheritancefeaturetoextendthefunctionalityoflanguageofSAPABAP.Herein
this post we are going to provide list of interview questions and also answers on
Inheritance topic. These questions are very frequently asked by the interviewers in the
interviews.

50 SAP ABAP Interview Questions for Freshers &


Experienced
SAP Web Dynpro ABAP Interview Questions
Answers
ALV Reports Interview Questions in SAP ABAP
SAP Project Management Realtime Interview
Questions Answers
SAP-BDC-Real-Time-Interview-Questions-AnswersPart-3
Module Pool Programming Interview Questions in
SAP ABAP
Free SAP PDF Books, Documents and Material free
Download
SAP BADI Interview Questions in ABAP
50 SAP ABAP ALE IDOC Interview Questions

1)Whatisinheritance?

BLOGARCHIVE
2014 (38)

Ans)
Inheritanceallowsyoutoderiveanewclassfromanexistingclass.You
dothisusingtheINHERITINGFROMadditionintheCLASSsubclass
DEFINITIONINHERITINGFROMsuperclassstatement.

2013 (59)
December (4)
November (4)
October (1)
September (5)

2)Whatarethevisibilitysectionsvisibletosubclassofsuperclass?
Ans)

August (8)
July (1)
June (3)

Onlythepublicandprotectedcomponentsofthesuperclassarevisible
inthesubclass.

May (5)
April (6)

3)Canwedeclaresamenameforcomponentsofsubclassascomponents
ofsuperclass?

March (1)
February (19)
SAP-ABAP-50-Common-Interview-Questions

Ans)
Subclassescontainallofthecomponentsofalloftheirsuperclasses
withintheinheritancetree.Onlythepublicandprotectedonesare
visible.Allpublicandprotectedcomponentswithinaninheritancetree
belongtothesamenamespace,andconsequentlymusthaveunique

http://www.sapabapiq.com/2013/02/sap-ooabap-inheritance-interview.html

SAP-ABAP-50-Common-Interview-Questionsin-Data-Dic...
SAP-TCODES-Starting-with-C-Letter-Part-3
SAP-TCODES-Starting-with-Letter-C-Part-2

1/6

10/3/2014

SAP-OOABAP-Inheritance-Interview-Questions-Answers
names.Thenamesofprivatecomponents,ontheotherhand,mustonly
beuniquewithintheirclass.

SAP-all-TCODES-Starting-with-C-Letter-Part-1

4)Whatissingleinheritance?

SAP-BDC-Real-Time-Interview-QuestionsAnswers-Part...

Ans)

SAP-BDC-Real-Time-Interview-QuestionsAnswers-Part...

Aclasscanhavemorethanonedirectsubclass,butitmayonlyhaveone
directsuperclass.Thisiscalledsingleinheritance.

SAP-BDC-Real-Time-Interview-QuestionsAnswers-Part...

SAP-BDC-Real-Time-Interview-QuestionsAnswers
SAP-ABAP-Message-Types

5)DoesOOABAPsupportsmultipleinheritance?
Ans)
No,OOABAPdoesnotsupportmultipleinheritancebutitsupportsmulti
levelinheritance.

SAP-R/3-ABAP/4-Open-SQL-Statements-andits-Usage
SAP-All-TCODES-Starting-With-B-Letter
SAP-ABAP-General-Object-Oriented-InterviewQuestio...
SAP-ABAP-Interface-Abstract-Class-InterviewQuesti...

6)Whatistherootnodeofallinheritancetrees?
Ans)
TherootnodeofallinheritancetreesinABAPObjectsisthepredefined
emptyclassOBJECT.Thisisthemostgeneralizedclasspossible,sinceit
containsneitherattributesnormethods.
Whenyoudefineanewclass,youdonothavetospecifyitexplicitlyas
thesuperclasstherelationshipisalwaysimplicitlydefined.

SAP-OOABAP-Inheritance-InterviewQuestions-Answers...
SAP-ABAP-Exception-Handling-Classes-andUsage
ABAP-Object-Oriented-Event-Handling-andTriggering...
SAP-TCODES-Starting-With-A-Letter
50 SAP ABAP ALE IDOC Interview Questions
January (2)

7)Howcanwereimplementsuperclassmethodinsubclass?
2012 (65)

Ans)
Superclassmethodcanbereimplementedinthederivedclassusing
redefinitionkeyword.

TOTALPAGEVIEWS

8)Canwechangetheparameterinterfaceoftheredefinedmethods?
Ans)
No,wecannotchangetheparameterinterfaceoftheredefinedmethods.

9)Howtocalloriginalmethodfromredefinedmethod?
Ans)
IntheredefinedmethodusetheSUPER>pseudoreferencetoaccessthe
originalmethodofthebaseclass.

10)Whatisanabstractclass?

Ans)
AclassdefinedasABSTRACTcannotbeinstantiated,thatisonecannot
useCREATEOBJECTwithreferencetotheclass.Tousetheinstance
componentsofanabstractclass,asubclassoftheclassmustbe
instantiated.

11)Canabstractmethodsberedefined?

http://www.sapabapiq.com/2013/02/sap-ooabap-inheritance-interview.html

2/6

10/3/2014

SAP-OOABAP-Inheritance-Interview-Questions-Answers
Ans)
Yes,abstractmethodsshouldberedefinedinthesubclass.Elseitgives
syntaxerror.Ifsubclassisalsoabstractclassesthennoneedtoredefine
theabstractmethod.

12)Canfinalclassmethodsberedefinedinthesubclass?
Ans)
Afinalmethodcannotberedefinedinasubclass.Finalclassescannot
havesubclasses.Theyconcludeaninheritancetree.

13)Canstaticmethodberedefined?
Ans)No,staticmethodscannotberedefined.

14)Canwechangethevisibilityoftheredefinedmethod?
Ans)
No,wecannotchangethevisibilityoftheredefinedmethod.Thatis,if
methodisdefinedinsuperclassinpublicsectionthenwecannotredefine
thesamemethodinthesubclassunderprotectedorprivate.

15)Cantheprivateandprotectedclassescanbeinherited?
Ans)
Yes,wecaninherittheprivateandprotectedclasses.Thenthesubclass
itselfbecomestheprivateorprotectedclass.

16)DoestheinstantiationofSubclassdependonthesuperclass?
Ans)
Whereasubclasscanbeinstantiateddependsonitsimmediatesuper
class:

i.Immediatesubclassesofobject,orclasseswiththeCREATE
PUBLICadditionimplicitlyinherittheCREATEPUBLICaddition.All
CREATEadditionsthatoverwritetheinheritedadditioncanbe
specifiedexplicitly.

ii.ImmediatesubclassesofclasseswiththeCREATEPROTECTED
additionimplicitlyinherittheCREATEPROTECTEDaddition.AllCREATE
additionsthatoverwritetheinheritedadditioncanbespecified
explicitly.

iii.ImmediatesubclassesofclasseswiththeCREATEPRIVATE
additionthatarenotfriendsoftheclassimplicitlyreceivetheCREATE
NONEaddition.Theycannotbeinstantiatedandyoucannotspecify
anyexplicitCREATEadditionsforthem.

iv.Immediatesubclassesthatarefriendsoftheclassimplicitly
inherittheCREATEPRIVATEaddition.AllCREATEadditionscanbe
specifiedforallsuperclassesthatcaninstantiatedasprivateusing
friends.

http://www.sapabapiq.com/2013/02/sap-ooabap-inheritance-interview.html

3/6

10/3/2014

SAP-OOABAP-Inheritance-Interview-Questions-Answers
17)Cantheconstructorberedefined?
Ans)
No,wecannotredefinetheinstanceconstructorofasuperclassina
subclass,neithercanyoucallonespecificallyusingthestatementCALL
METHODCONSTRUCTOR.

18)Doestheparameterinterfaceoftheinstanceconstructorbechanged
inthesubclass?
Ans)
Theparameterinterfaceforinstanceconstructorofeachclassmaybe
differentinaninheritancetree.

19)Doweneedtocallthesuperclassinstanceconstructorinthe
subclasswheninstanceconstructorisredefined?
Ans)
Duringimplementationofredefinedinstanceconstructorinderivedclass
,theinstanceconstructorofthesuperclassmustbecalledwiththe
CALLMETHODSUPER>constructorEXPORTINGstatement.

20)Inwhichordertheconstructorsexecuteininheritancetree?
Ans)
Thefirsttimeasubclassisaddressedinaprogram,theruntime
environmentreachesforthenexthighestsuperclasswhoseconstructor
hasnotyetbeenexecuted.
Thisconstructorisexecutedfirst,followedbyconstructorsdownthepath
untiltheaddressedsubclassisreached.

21)Canwecalltheinstanceconstructorofthesuperclassinsubclass?
Ans)
Yes,wecancalltheinstanceconstructorofthesuperclassexplicitlyin
subclassinstanceconstructorusingPseudoreference(SUPER>).
Thisistheonlyplacewherewecalltheconstructorexplicitly.

22)Canwecallthestaticconstructorofthesuperclassinsubclass?
Ans)
NO,wecannotcallthestaticconstructorexplicitly.Theruntime
environmentautomaticallyensuresthatthestaticconstructorsarecalled
intherightorder,soitisnotrequiredtocallthestaticconstructorofthe
superclassexplicitly.

23)Whatispolymorphism?

Ans)

http://www.sapabapiq.com/2013/02/sap-ooabap-inheritance-interview.html

4/6

10/3/2014

SAP-OOABAP-Inheritance-Interview-Questions-Answers
Whenobjectsfromdifferentclassesreactdifferentlytothesamemethod
calls,thisisknowaspolymorphism.Thisisachievedthroughinheritance
andinterfaces.

24)WhatisNarrowingcast(Upcast)?Explainbriefly?
Ans)
Assigningsubclassreferencetosuperclassreference.Syntaxfor
narrowingcastis=orMOVETO.Ifyouassignasubclassreference
toasuperclassreference,thisensuresthatallcomponentsthatcanbe
accessedsyntacticallyafterthecastassignmentareactuallyavailablein
theinstance.
Thesubclassalwayscontainsatleastthesamecomponentsasthesuper
class.

25)WhatistheuseofNarrowingcast?
Ans)
Typicaluseofnarrowingcastassignmentistoprepareforgenericaccess.
Auserwhoisnotatallinterestedinthefinerpointsoftheinstancesof
thesubclassesbutwhosimplywantstoaddressthesharedcomponents
coulduseasuperclassreferenceforthisaccess.

26)Whichcomponentsofsubclasscanbeaccessedfromsuperclass
referenceusingnarrowingcast?
Ans)
Onlytheinheritedcomponentscanbeaccessedfromsuperclass
referenceafternarrowingcast.

27)WhatisWideningcast(Downcasting)?
Ans)
Assigningsuperclassreferencetosubclassreference.Syntaxfor
wideningcastis?=orMOVE?TO.

28)WhatistheuseofWideningcast?
Ans)
Typicaluseofforwideningcastassignmentsiswhenspecificcomponents
ofinstancesneedtobeaddressedandtheirreferencesarekeptin
variablesthataretypedonthesuperclass.
Auserwhoisinterestedinthefinerpointsoftheinstancesofasubclass
cannotusethesuperclassreferenceforthisaccessbecauseitonly
allowsaccesstothesharedcomponents.

DearABAPersifyouknowanyotherquestionspleaseshareyourviewsin
belowcommentbox.

"Youfoundtheinformationhelpfulandwanttosaythanks?Yourdonationisenoughto
inspireustodomore.Thanksabunch!"

http://www.sapabapiq.com/2013/02/sap-ooabap-inheritance-interview.html

5/6

10/3/2014

SAP-OOABAP-Inheritance-Interview-Questions-Answers

Postedin:ObjectOrientedABAP,ObjectOrientedABAPInterviewQuestions

Newer Post

Home

Older Post

0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.

Enteryourcomment...

Commentas: GoogleAccount

Publish

Preview

Categories

ABAP Interview Questions (109) ABAP Open SQL Statements (1) ABAP Syntax Rules (6) ABAP WORKBENCH

(2) ALE IDOC (6) ALE IDOC Interview Questions (6) ALV Interview Questions (5) BADI (2) BAPI (1) BAPI Interview Questions (1) BDC (6)
BDC Interview Questions (6) Classical Reports Interview Question (3) Conditional Statements (1) Cross Applications (3) Data

Dictionary (22)

Data Type Questins (1) Data types (1) Dialog programming (5) Dialog Programming Interview Questions (4) DOMAIN
Interview Questions (1) Function Module (2) IDoc Tutorials (6) Interactive Report Interview Questions (4) Internal Tables (1) Lock Object

Interview Questions (1) Logical Database (1) Modularization Interview Questions (4) Module Pool Programming (5) Object Oriented
ABAP (19) Object Oriented ABAP Interview Questions (15) OOABAP (9) Reports (14) Reports Interview Questions (9) RFC
(1) RFC Interview Questions (1) SAP ABAP Interview Questions (38) SAP ABAP Introduction (46) SAP ABAP Message

SAP Basics (69)

SAP Books (2) SAP Certification (1) SAP CONSULTANTS (5) SAP
Types (2) SAP BADI Interview Questions (2)
CRM (1) SAP ENHANCEMENTS (3) SAP EXITS (2) SAP EXITS ( SAP ENHANCEMENTS ) Interview Questions (1) SAP Free Books (1) SAP HR (2)
SAP Lock Object (1) SAP Open SQL Statements (1) SAP R/3 Architecture (4) SAP Search help (1) SAP Smartforms (1) SAP Smartforms Interview
Questions (2) SAP Tables (5) SAP Tcodes (10) SAP Views (1) SAP Webdynpro ABAP (12) SAP Work Processors (2) SAP Workflow (3)
Scripts (3) Scripts Interview Questions (2) Search Help Interview Questions (1) Smartforms (1) Table Maintenance Generator (1) Tables in SAP (2)
Tables Interview Questions (3) Type Group Interview Questions (1) Variable Declaration (1) Views Interview Questions (1) Webdynpro (12)

Protected Blog

Copyright 2014 SAP ABAP Interview Questions | Powered by Blogger

This blog is not affiliated to SAP AG |SAP is trademark of SAP AG |The information collected from various sources use information with your own risk.

http://www.sapabapiq.com/2013/02/sap-ooabap-inheritance-interview.html

6/6

You might also like