‎2007 Dec 20 8:09 AM
Hi to all,
can any one explains me about final concept in oops?
Thanks
Priya
‎2007 Dec 20 9:07 AM
the class which has been given attribute final cannot be inherited
‎2007 Dec 20 9:07 AM
the class which has been given attribute final cannot be inherited
‎2007 Dec 20 9:19 AM
Hi Prema,
"FINAL" keyword denotes that it is the final implementation for that method or variable or class. You cant override the FINAL method and you can not inherite the FINAL class.
Thanks,
Vinay
‎2007 Dec 21 6:58 AM
Hello Priya,
you can prevent a class from being inherited by using the FINAL addition with the CLASS statement.
You can prevent a method from being redefined by using the FINAL addition with the METHODS statement.
The relevant indicator is in the Class Builder on the Attributes tab for that class or method.
CLASS lcl_... DEFINITION FINAL
..........................{ INHERITING FROM ... } . Inheritance from this class not possible
...
ENDCLASS.
CLASS lcl_... DEFINITION .
...
METHODS ... FINAL ... Method cannot be redefined
...
ENDCLASS.
All methods of a final class are implicitly final: therefore , you may not repeat the FINAL addition in the methods themselves.
Classes that are final should only contain static components.
Bye,
Peter
‎2007 Dec 21 8:16 AM