Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

class declaration

Former Member
0 Kudos

hi all

can classes be both final and abstract?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi,

What sujit mentioned is true about Final Class but for Abstract plz refer t othe Link.

http://www.sap-img.com/java/when-we-go-for-abstract-and-interface.htm

hope this will help.

Sumit Agarwal

7 REPLIES 7

Former Member
0 Kudos

Hi,

In SAP Final Class Means that class can not be inherited by any Child Class.

There is no such Abstract class in Sap

Regards,

Sujit

0 Kudos

thnanx for ur reply sujit..

is it means we can not declare a class both final and abstract..

0 Kudos

Hi,

Check yhis link there are dEtaild description about your Doubt-

http://www.sap-press.de/katalog/buecher/htmlleseproben/gp/htmlprobID-28?GalileoSession=22448306A3l7U...

Regards,

Sujit

Former Member
0 Kudos

hi,

What sujit mentioned is true about Final Class but for Abstract plz refer t othe Link.

http://www.sap-img.com/java/when-we-go-for-abstract-and-interface.htm

hope this will help.

Sumit Agarwal

Former Member

Former Member
0 Kudos

Hi,

you can define a class as abstract AND final in ABAP OO, but it makes no sense I think.

To do this means at least that you could only use as 'static' defined class components.

You can't set an instance method static and final at the same time !

Regards

Olaf

0 Kudos

Hi Olaf,

that was an intersting thing you pointed out.

But I still fail to justify allowing a class that is both abstract and final.

The usage that you mentioned should be actually served by an interface.

I also noted that the syntax check allows a class to be both final and abstract although an abstract method may be defined in it. This is again meaningless.

Zakir