2014 Apr 28 10:36 AM
Hello developers,
I am trying to implement the following (simple) classes:
class abstract_class definition abstract
public
create public .
...
protected section
methods parse_string abtract
importing
value(i_str) type string.
methods to_table.
...
endclass.
class abstract_class implementation.
method to_table.
...
me->parse_string( str ).
...
endmethod.
endclass.
*---------------------------------------------------------------------------*
class other_class definition
public
inheriting from abstract_class
final
create public .
...
protected section.
methods parse_string redefinition.
...
endclass.
class other_class implementation.
method parse_string.
* some codes
endmethod.
endclass.
I have instantiated the class other_class. But when I call the method to_table, I am getting the error "CALL METHOD NOT IMPLEMENTED" on the method parse_string. Where is my mistake ?
Thank you for your replies.
Best regards,
Nicolas
2014 Apr 29 6:58 AM
Hello everyone,
First of all, thank you for all your reply.
During the night, I have thought to my problem and I found the solution. In fact, I made a (very) great mistake. Here is my code:
CLASS abstract_class IMPLEMENTATION.
method constructor.
me->to_table( ).
endmethod.
method to_table.
...
me->parse_string( a_string ).
...
endmethod.
ENDCLASS.
CLASS other_class IMPLEMENTATION.
method constructor.
call method super->constructor.
endmethod.
method parse_string.
* some code
endmethod.
ENDCLASS.
The problem is: I call the method parse_string of my child class (with the instruction me->parse_string) before my child class is instantiated... (Now, I can jump out the window.) Vadim Vologzhanin 's reply helped me by asking where I instantiated my child class.
Thank you !
Best regards,
Nicolas
Hello developers,
I am trying to implement the following (simple) classes:
class abstract_class definition abstract
public
create public .
...
protected section
methods parse_string abtract
importing
value(i_str) type string.
methods to_table.
...
endclass.
class abstract_class implementation.
method to_table.
...
me->parse_string( str ).
...
endmethod.
endclass.
*---------------------------------------------------------------------------*
class other_class definition
public
inheriting from abstract_class
final
create public .
...
protected section.
methods parse_string redefinition.
...
endclass.
class other_class implementation.
method parse_string.
* some codes
endmethod.
endclass.
I have instantiated the class other_class. But when I call the method to_table, I am getting the error "CALL METHOD NOT IMPLEMENTED" on the method parse_string. Where is my mistake ?
Thank you for your replies.
Best regards,
Nicolas
2014 Apr 28 10:43 AM
2014 Apr 28 10:43 AM
Hi Nicolas,
Can you upload a txt of your code so it could be analyzed it is difficult to see like this...
Thanks
2014 Apr 28 5:42 PM
Hello, Nicolas!
How did you instantiated the object? How did you called the method? Could I look at your code?
If you did it like this, it should work fine:
DATA: lo_other TYPE REF TO other_class
CREATE OBJECT lo_other.
lo_other->to_table( ).
2014 Apr 28 11:19 PM
Hello Nicolas,
Abstract classes are only for declaration. You can not implement them. Remove the implementation of your abstract class. (comment out or delete the following lines of code from you program and check again:).
class abstract_class implementation.
method to_table.
...
me->parse_string( str ).
...
endmethod.
endclass.
You can only implement the subclasses of the abstract class.
Thanks,
John.
2014 Apr 29 6:09 AM
But John, to_table isn't abstract. The abstract method is parse_string.
To really help, we need the code where you instantiate the class and call the method. As it stands, there are no accessible methods in the class - they're all protected. There is not one that is public.
2014 Apr 29 6:18 AM
hi,
did u call the object of the class other_class.i think you have called the abstract class (abstract_class)object .
2014 Apr 29 6:58 AM
Hello everyone,
First of all, thank you for all your reply.
During the night, I have thought to my problem and I found the solution. In fact, I made a (very) great mistake. Here is my code:
CLASS abstract_class IMPLEMENTATION.
method constructor.
me->to_table( ).
endmethod.
method to_table.
...
me->parse_string( a_string ).
...
endmethod.
ENDCLASS.
CLASS other_class IMPLEMENTATION.
method constructor.
call method super->constructor.
endmethod.
method parse_string.
* some code
endmethod.
ENDCLASS.
The problem is: I call the method parse_string of my child class (with the instruction me->parse_string) before my child class is instantiated... (Now, I can jump out the window.) Vadim Vologzhanin 's reply helped me by asking where I instantiated my child class.
Thank you !
Best regards,
Nicolas
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |