on 06-08-2007 7:44 AM
Hi Gurus,
I am new to WDA and OOPs . Some doubts
1 - Interface IF_WD_CONTEXT_NODE is implemented in which class.?
2 - What do you mean by attribute of an Interface (i.e WD_CONTEXT ) ?
TABLE_NODE = WD_CONTEXT->GET_CHILD_NODE( 'MY_TABLE_NODE' ).-- means what ?
3 - Why do we create objects of Interfaces and not classes that implement them ?
e.g data: TABLE_NODE type ref to IF_WD_CONTEXT_NODE.
4. Can i see the code for the CLASS that implements these INTERFACES ?
5. When and where are the objects for the classes created ?
(as in ABAP OOPs - CREATE OBJECT <varname> ).
Help me out.
Thanks in advance.
Hi
The answers.
1. IF_WD_CONTEXT_NODE is implemented in the class CL_WDR_CONTEXT_NODE,
2.You could define attributes for an interface , so that it will be available to all teh classes implementing the interface.
3."The purpose of using interface is that you could store the instance of different implementing class according to the situation"
4.Yeah , you can go to teh CL_WDR classes and see it.
5.The objects are created in different places , for example if you go to CL_WDR_CONTEXT_NODE , CREATE method you could see the following code.
if node_info->_mapping_info-is_mapped is initial.
create object node type cl_wdr_context_node_val
exporting
parent_element = parent_element
node_info = node_info
node_name = node_name
context = context.
else.
create object node type cl_wdr_context_node_map
exporting
parent_element = parent_element
node_info = node_info
node_name = node_name
context = context.
endif.
Cheers
Anzy
Reward points if this answers to your question
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jimmy,
Let the context node be type of if_wd_context_node , and some where in the webdynpro the object will be created which means , an object of CL_WDR_CONTEXT_NODE. During the process it will be assigned to the interface
WD_CONTEXT , in the webdynpro ......so the interface will be holding an instance of CL_WDR_CONTEXT_NODE.
And we know that CL_WDR_CONTEXT_NODE. implements the interface IF_WD_CONTEXT_NODE.
So when you assign CL_WDR_CONTEXT_NODE instance to WD_CONTEXT ( of type IF_WD_CONTEXT_NODE )..Only those methods which are part of the IF_WD_CONTEXT_NODE will be available in WD_CONTEXT.
You can call this as a kind of type casting....:-) ..This is how the objects work in ABAP.
Thanks
Anzy
Hi
let me add some more clarification .
A be an interface , having three method definitions.
B is a class which implements A ( So B will be having implementation of 3 methods of A as well as some additional methods of B , let it 2 ). so B will be having total five method implementation.
So when create an instance of B and assign that to a variable of A , only the 3 methods will be copied .
Thanks
Anzy
And you can't directly call from a variable of the interface unless an object is assigned to it.
User | Count |
---|---|
78 | |
9 | |
8 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.