z745oops11
-
Upload
yellareddy-tarigopula -
Category
Documents
-
view
213 -
download
0
description
Transcript of z745oops11
report z745oops11. Instance and Static constructors execution
class abc definition. public section. methods constructor. "instance const class-methods class_constructor. "static const methods m1. "instance normal method class-data x type i. "static attrendclass.
class abc implementation. method constructor. write :/ 'inside instance constructor...'. endmethod.
method class_constructor. write :/ 'inside static constructor...'. endmethod.
method m1. write :/ 'inside instance method m1....'. endmethod.endclass.
start-of-selection.abc=>x = 10. "invokes static const
uline.write :/ 'First object creation....'.data ob1 type ref to abc.create object ob1.
*call method ob1->constructor. "syntax error as const cannot be called explictlyuline.write :/ 'Calling instance normal method m1 multiple times using same object....'.call method ob1->m1.call method ob1->m1.
uline.write :/ 'Second object creation....'.data ob2 type ref to abc.create object ob2.
uline.write :/ 'Third object creation....'.data ob3 type ref to abc.create object ob3.