Application Development and Automation 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: 
Read only

casting & abstract class & final method

0 Likes
774

what is casting abstract class & final method in ABAP Objects give some scenario where actually use these.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
701

HI

Abstract Class is used for just declaration purposes. Its methods must be implemented in the class which implements it.

Final method is one whose definition cant be over-ridden.

For ex.. You may declare a shape class as abstract. It may contain a number of methods like color, size, etc.. but its methods are implemented in the classes that implement it like rectangle, square etc...

regards

Swati

4 REPLIES 4
Read only

GrahamRobbo
SAP Mentor
SAP Mentor
0 Likes
701

Hi Suri,

casting essentially means that the memory area can be handled assuming a particular type. This is enabled by field symbols.

Abstract classes cannot be instantiated. You use abstract classes as templates for subclasses. In other words abstract classes can only be used in subclasses.

Final classes cannot be inherited. In other words you cannot create subclasses.

Cheers

Graham

Read only

Former Member
0 Likes
702

HI

Abstract Class is used for just declaration purposes. Its methods must be implemented in the class which implements it.

Final method is one whose definition cant be over-ridden.

For ex.. You may declare a shape class as abstract. It may contain a number of methods like color, size, etc.. but its methods are implemented in the classes that implement it like rectangle, square etc...

regards

Swati

Read only

0 Likes
701

give some scenarios

Read only

0 Likes
701

Hi Sri,

I'm not sure we can be any more clear.

An Abstract class can not be instantiated. It can only be used as the superclass for it's subclasses. In other words it <b>can only be inherited</b>.

A Final class cannot be the superclass for a subclass. In other words <b>it cannot be inherited.</b>

I recommend the book <a href="http://www.sappress.com/product.cfm?account=&product=H1934">ABAP Objects: ABAP Programming in SAP NetWeaver</a>

Cheers

Graham