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

question on CLASS creation

Former Member
0 Likes
449

hi all,

i just have some doubt about creation of CLASS.

why must we use a OBJECT REFERENCE to create a instance, is there any other method on creating instance ?

it's better tht some people tell me the mechanism of this process.

regards

3 REPLIES 3
Read only

matt
Active Contributor
0 Likes
429

To instantiate a class, you use CREATE OBJECT objref, where objref is of type REFERENCE TO class. This creates an instance of the class, and assigns the reference to objref. All access to the instance is through this object reference. It is impossible to deal with instances of classes without an object reference somewhere.

matt

Read only

former_member5472
Active Contributor
0 Likes
429

Hi,

CREATE OBJECT refobject will actually instatiate the class.

in lay-man point of view its like creating a copy of the class by which we can access all the properties( here attributes or methods) if any of the class .

we cannot directly access the class . we need to have a ref object to access the class.

thanks

pratyush

Read only

marcelo_ramos1
SAP Mentor
SAP Mentor
0 Likes
429

Hi Chao,

Instance is the one of the main mechanism of the Objects Oriented. You must use a reference variable to create the Instance.

Certainly the use of ABAP OO brings many advantages over procedural ABAP.

"ABAP Objects is indicated for who wants to guarantee agility during the development, minimize the efforts during the modifications, enhance existing applications and create complex applications using a simple way..."

font: [ABAP Objects|https://wiki.sdn.sap.com/wiki/x/o5k]

You can see samples of ABAP Objects use on [ABAP Objects Examples|https://wiki.sdn.sap.com/wiki/x/Aq].

Also there many information on [Object-oriented programming|http://en.wikipedia.org/wiki/Object-oriented]

Don't forget to close this thread and all yours previous when your question be answered ! In case of doubt read the [rules of engagement|].

Regards.

Marcelo Ramos