Skip to Content
-2

Issue while instantiating object of abstract class

Apr 12, 2017 at 07:20 AM

74

avatar image

Hi All,

I am stuck in this issue. I have two classes -

class 1 - which is an abstract class

class 2 - my class where i want to call a method ( "setup ") of class 1.

I cannot make class 1 as the super class of class 2, as I have already another super class.

I have done this till now -

1. Created an object of class 1 in class 2.

mr_set type ref to "class 1".

mr_set->setup( ). or

CALL METHOD mr_set->setup.

this gives me an error - Method "SETUP" is unknown or PROTECTED or PRIVATE.

2. Then i tried to declare class 2 in the "friend" list of class 1.

this does not give me any error. But in debug mode, it raises some kind of exception.

Can anyone please help me with it.

Thanks

Meenakshi

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Horst Keller
Apr 12, 2017 at 07:49 AM
1

"I have done this till now -

1. Created an object of class 1 in class 2. "

How that? You cannot create objects of abstract classes.

"this gives me an error - Method "SETUP" is unknown or PROTECTED or PRIVATE."

How and where is setup declared?

"Can anyone please help me with it."

No, ABAP has no means to overcome these limitations.

Show 3 Share
10 |10000 characters needed characters left characters exceeded

Hi Horst,

Please find these details -

1. In class2, in attributes section I have done this declaration -

protected section.

data MR_SET type ref to class1 .

2. Set up is declared in my class 1 .

protected section.

methods SETUP .

Do you need any more details ?

Thanks and Regards

Meenakshi

0

Still confusing. Is class1 the same as /SIE/KFP_CLASS_DIALOG?

  • You cannot create an instance of an abstract class.
  • You can call methods of a protected section in subclasses only.

It seems that you try to do things that are simply not allowed.

0

okay. then it seems that i will have to find another way to do my code, as I cannot access the method of this class.

Thanks Horst. :)

0