‎2008 Aug 23 2:23 AM
CLASS lcl_course DEFINITION.
PUBLIC SECTION.
METHODS: get_course_name IMPORTING im_name type string.
CLASS-METHODS: list_prices_and_discounts.
ENDCLASS.
CLASS lcl_course IMPLEMENTATION.
METHOD get_course_name.
ENDMETHOD.
METHOD list_prices_and_discounts.
ENDMETHOD.
ENDCLASS.
Data: course1 type ref to lcl_course,
course2 type ref to lcl_course.
Start-of-selection.
Create object course1.
call method course1->list_prices_and_discounts(). """""""" would this call be considered right??
All i want to know is , can we call the static attributes/methods of a class from the instance??...
Is it required that we should only call static attributes with Class names in our program??
should i only use lcl_course=>list_prices_and_discounts().
‎2008 Aug 23 2:54 AM
‎2008 Aug 23 2:54 AM
‎2008 Aug 23 2:59 AM
‎2008 Aug 23 3:09 AM
it is possible in case of static attr/methods like instance variables/methods we can call using instance.
‎2008 Aug 23 7:30 AM
>
> CLASS lcl_course DEFINITION.
> PUBLIC SECTION.
> METHODS: get_course_name IMPORTING im_name type string.
> CLASS-METHODS: list_prices_and_discounts.
> ENDCLASS.
>
> CLASS lcl_course IMPLEMENTATION.
> METHOD get_course_name.
> ENDMETHOD.
> METHOD list_prices_and_discounts.
> ENDMETHOD.
> ENDCLASS.
>
> Data: course1 type ref to lcl_course,
> course2 type ref to lcl_course.
> Start-of-selection.
> Create object course1.
>
> call method course1->list_prices_and_discounts(). """""""" would this call be considered right??
>
>
> All i want to know is , can we call the static attributes/methods of a class from the instance??...
>
> Is it required that we should only call static attributes with Class names in our program??
>
> should i only use lcl_course=>list_prices_and_discounts().
Why don't you simply try it? If list_prices_and_discounts() on it's own works, then fine. If not then you know you must use the class name.
As a matter of good programming style, I always use the class name, even in static methods, as then it is clear what is going on, that the method or attribute is static. Similarly in instance methods, I always use me-> when referencing other instance methods or attributes,
I reaaly don't understand why this kind of question is asked. Are you afraid that if you use the wrong syntax you'll break the system or something?
‎2008 Aug 23 7:38 AM
Matt,
When i posted that time name is some thing , now it become XYZ. interesting.
‎2008 Aug 29 1:12 AM