Inheritance & CrossInheritance & Cross

This page is part of an incremental translation project. Body text not yet translated to Turkish falls back to English even in TR mode.

Inheritance, object oriented programming'in key konseptlerinden biridir. Bu bölüm, inheritance'ı ve ilgili konseptleri tanıtmayı amaçlar.Inheritance is one of the key concepts of object oriented programming. This sections aims to introduce inheritance and relelated concepts.

"Inheritance" Nedir?What is “Inheritance”?

Basitçe, inheritance, programcıların class kodlarını yeniden kullanmasına olanak tanıyan bir object oriented programming mekanizmasıdır. Bu yöntemde, programcılar iki class arasında parent, child ilişkisi oluşturur. Bir child class, feature'larını/davranışını bir miras yoluyla parent'ından alır ve parent'ın davranışlarını/feature'larını değiştirir veya yeni feature'lar/davranışlar ekler.Simply, inheritance is an object oriented programming mechanism that allows programmers to reuse class codes. In this method, programmers creates parent, child relationship between two class. A child class gets its features/behavior from its parent through a heritage and modifies parent’s behaviors/features or adds new features/behaviours.

TROIA'da InheritanceInheritance on TROIA

TROIA, object oriented bir programlama dilidir ve tüm TROIA item type'ları (class, dialog, report, component) için inheritance'ı destekler.TROIA is an object oriented programming language and supports inheritance for all TROIA item types (class, dialog, report, component).

Diğer programlama dillerinde olduğu gibi, sadece bir item'ı inherit etmek yapısını veya davranışını değiştirmek anlamına gelmez, sadece base class'tan miras oluşturmak anlamına gelir. Pratikte, bir item'ı sadece inherit ederseniz, base item'ı child'ın ismiyle kullanabilirsiniz. Davranışı/yapıyı değiştirmek için, base item'ın en az bir method'unu override etmeli veya child item'a yeni bir method eklemelisiniz. Base method'lardan biriyle aynı isimde bir method eklerseniz, bu method'u "override" ettiğiniz ve davranışını değiştirdiğiniz anlamına gelir. TROIA jargonunda, override etmeye bir method'u inherit etmek denir (bu kitapta "inherit method" terimi yerine "override method" terimini kullanacağız).As it is same in other programming languages, only inheriting an item does not mean changing its structure or behaviour, it only means creating heritage from base class. In practical if you only inherit an item, you can use base item with child’s name. To change behaviour/structure, you must override one at least one method of base item or add a new method to child item. If you add a method which has same name with one of the base methods this means you “override” this method and change its behaviour. In TROIA jargon, overriding is called inheriting a method (In this book we will use “override method” term instead of “inherit method”).

TROIA'da bir item yalnızca bir base item'ı inherit edebilir. Başka bir deyişle, bir sub class yalnızca tek bir base class'a sahip olabilir. Ama bir child class'ı inherit etmeye izin verilir. Örneğin "class A", class C'nin child'ı olan class B'yi inherit edebilir.In TROIA an item can inherit only one base item. In other words, a sub class can only have a single base class. But it is allowed to inherit a child class. For example class A” can inherit class B which is child of class C.

Teknik arka plana gelince, inheritance'ı tüm yönleriyle iyi anlamak için, tüm inherit etme operation'larının compile time'da gerçekleştirildiğinden, compiler'ın inheritance sürecinde en önemli role sahip olduğunu bilmeniz gerekir. Bir child class'ı compile ederken, compiler önce parent/child bilgisini çözer ve compilation'dan sonra child item'ın binary dosyasını oluşturur. Bu binary dosya, child item'ın kendi control'lerini/method'larını içerir, ayrıca base'in binary data'sıyla bir tür link'e sahiptir.When it comes to technical background, for a good understanding of inheritance with all aspects, you need to know that compiler has the most important role in inheritance process, because all inheriting operations are performed on compile time. While compiling a child class, compiler resolves parent/child information at first and after the compilation it creates child item’s binary file. This binary file contains child item’s own controls/methods, additionally it has a kind of link with base’s binary data.

Class'ları Inherit EtmeInheriting Classes

Class inheritance'ında, base class'a yeni method'lar eklemek veya base class'ın method'larını override etmek (TROIA'da method inherit etmek olarak adlandırılır) mümkündür. Bir class'ı override etmek için, IDE'de new class form'unda base class ismini belirtmelisiniz (classes bölümüne bakın). Bir class'ı inherit ettiğinizde, base class'ın method'ları object explorer'da base class tree element'inde gösterilir. Aşağıdaki görsel, Object Explorer'da inherited bir class'ın görünümünü ve base method'lardan birini override etmek için menü öğesini gösterir.In class inheritance it is possible to add new methods to base class or override (called as inherit method in TROIA) methods of base class. To override a class you must indicate base class name in new class form on IDE (see classes section). When you inherit a class, method’s of base class are shown on object explorer in base class tree element. Image below shows the view of an inherited class on Object Expolorer and menu item to override one of base methods.

TROIA screenshot

Bir base class method'unu override ettiğinizde, sistem child class'ta aynı isimde bir method oluşturur ve bu method base method yerine çalıştırılır, bu da base method'un davranışını değiştirmeye olanak tanır. Aynı yöntemle, _VARIABLES ve _CONSTRUCTOR method'larını override etmek de mümkündür. Bu method'ları override ederek, member variable'lar eklemek mümkündür ve bu, base class'ın yapısını child'ında değiştirmek anlamına gelir (bu method'ların key rollerini hatırlayın.)When you override a base class method, system creates a same named method on child class and this method is executed instead of base method and this allows changing base method’s behavior. Using same method, overriding _VARIABLES and _CONSTRUCTOR methods is also possible. With overriding this methods, it is possible to add member variables and this means changing the structure of base class on its child (remember the key roles of this methods.)

Dialog'ları/Component'leri Inherit EtmeInheriting Dialogs/Components

Dialog ve component inherit etmek de desteklenir. Bir dialog, component'i inherit etmek için, new item form'unda base item'ını ayarlamalısınız (lütfen ilgili bölümlerde new dialog, component form'una bakın). Dialog method'larını override etmek, önceki bölümlerde bahsedilen base class method'larını override etmeye benzer. Dialog'lardaki/component'lerdeki control'leri ve control event'lerini override etmek de mümkündür. Ayrıca, child dialog/component'e yeni control'ler ve control event'leri eklemek de mümkündür. İşte DEVT11D001'i base dialog olarak inherit eden yeni bir dialog oluşturmayı gösteren bir görsel (component inheritance için de aynıdır).Inheriting dialog and component is also supported. To inherit a dialog, component you must set its base item in new item form (please see new dialog, component form on related sections). Overriding dialog methods is similar with overriding base class methods which is mentioned previous sections. It is also possible to override controls and control events on dialogs/components. Additionally, adding new controls and control events to child dialog/component is possible. Here is an image below that shows creating a new dialog that inherits DEVT11D001 as base dialog (it is also same for component inheritance).

TROIA screenshot

Inherited bir dialog oluşturduktan sonra, IDE property explorer'da (1) base dialog ismini, object explorer'da (2) base dialog control'lerini/method'larını ve dialog design panel'inde (3) base dialog control'lerini gösterir. Lütfen aşağıdaki görsele bakın:After creating an inherited dialog, IDE shows base dialog name in property explorer(1), base dialog controls/methods on object explorer(2) and base dialog controls on dialog design panel (3). Please see the image below:

TROIA screenshot

Dialog design panel'inde herhangi bir control'ün pozisyonunu veya diğer property'lerini değiştirmek mümkün değildir, çünkü bu control'ler base dialog'un control'leridir. Bir control feature'ını değiştirmek için, önce control'ün sağ tık menüsünde bulunan "inherit" butonunu kullanarak control'ü override etmelisiniz. Bir dialog control'ünü override etmek, child dialog'da yeni bir control oluşturur ve bu yeni control, parent dialog'daki aynı isimli control'ün üzerine yazılır.In dialog design panel it is not possible to change any control’s positon or other properties, because this controls are base dialog’s controls. To change a control feature you must firsly override control using “inherit” button which is located on control’s right click menu. Overriding a dialog control creates a new control on child dialog and this new control overwrites same named control on parent dialog.

TROIA screenshot

Base item'ın davranışını değiştirmek için bir dialog'u ve control event'lerini override etmek de mümkündür. Bir control/dialog event'ini override etmek için, control'ün veya dialog'un sağ tık menüsündeki "mavi ok"a tıklamalısınız. Bu operation, dialog ve class method'larını override etmeye benzer şekilde, child class'ta aynı id ile bir event kodu oluşturur ve base event'in üzerine yazar.It is also possible to override a dialog and control events to change base item’s behavior. To override a control/dialog event you must click “blue arrow” on control’s or dialog’s right click menu. This operation creates an event code on child class with same id and overwrites base event, similar to overriding dialog and class methods.

TROIA screenshot

Control event'lerini override etmek için, control'ün kendisini override etmenize gerek yoktur. Control'ün data'sı ve event'lerinin farklı identification'ı vardır ve her ikisi de override edilebilir item'lardır.To override control events, you don’t need to override control’s itself. Control’s data and events has different identification and both are overridable items.

IDE Object Explorer'da ve control/dialog sağ tık menüsünde, her method için bazı küçük icon'lar (renkli noktalar) vardır. Bu icon'ların özel anlamları vardır ve bir method'un override eden bir method olup olmadığını anlamayı kolaylaştırır. İşte icon'ların anlamları:In IDE Object Explorer and control/dialog right click menu, there are some small icons (colorful dots) for each method. This icons have special meanings and eases understanding whether method is an overriding method or not. Here are meanings of icons:

Method/event does not override any parent method/event.
Method/event overrides a parent method/event.
Used for only control or dialog/component/report events. Event is implemented in base class but not overridden by child item.

SUPER() Keyword'ünü KullanmaUsing SUPER() Keyword

SUPER() keyword'ü, override edilen method'un kodunu compile time'da override eden method'a ekler. Bu yöntemle override eden method, override edilen davranışı miras alıp ek davranışlar gerçekleştirebilir. Başka bir deyişle SUPER() bir function çağrısı değildir, compile seviyesi bir identifier'dır. Bu yüzden base method'un bir RETURN komutu varsa, override eden method'un içeriği TROIA interpreter tarafından yok sayılır. Class A'nın class B'yi inherit ettiğini ve M1 method'unu override ettiğini varsayın:SUPER() keyword adds overridden method’s code to overriding method on compile time. With this method overriding method can inherit overridden behaviour and perform additional behaviours. In other words SUPER() is not a function call, it is a compile level identifier. Therefore if base method has a RETURN command, overriding methods content is ignored by TROIA interpreter. Assume that class A inherits class B and overrides its M1 method:

/* class B, method M1 *//* class B, method M1 */

OBJECT:OBJECT:

TABLE T1; TABLE T1;

SELECT * FROM IASUSERSELECT * FROM IASUSER

INTO T1; INTO T1;

RETURN;RETURN;

/* class A method *//* class A method */

SUPER();SUPER();

CLEAR ALL T1;CLEAR ALL T1;

Compile time'da, TROIA compiler base class'ın M1 method'unu child M1'e ekler ve ortaya çıkan kodu child class'ın M1 method'u olarak compile eder. İşte class A için compile edilmiş M1:On compile time, TROIA compiler adds M1 method of base class to child M1 and compiles the resulting code as M1 method of child class. Here is the compiled M1 for class A:

/* class A method/* class A method

compile time'da */ on compile time */

OBJECT:OBJECT:

TABLE T1; TABLE T1;

SELECT * FROM IASUSERSELECT * FROM IASUSER

INTO T1; INTO T1;

RETURN;RETURN;

CLEAR ALL T1;CLEAR ALL T1;

Bu örnekte görüldüğü gibi, SUPER() keyword'ünü kullanan programcılar, override eden içeriği iptal etme riski nedeniyle override edilen method içeriğini dikkate almalıdır. Ayrıca SUPER() keyword'ü kullanarak base function'ın return değerini almak da mümkün değildir, çünkü bu bir function çağrısı değil, sadece bir keyword'dür.As it is obvious on this example, programmers who use SUPER() keyword must consider overridden method content due to risk of canceling overriding content. Also it is not possible to getting return value of base function using SUPER() keyword, because it is not a function call its just a keyword.

SUPER() genellikle override eden method'ların başında kullanılsa da, override eden method'un herhangi bir yerinde de kullanmak mümkündür. SUPER() keyword'ü class, dialog, component ve report event'lerinde ve kodlarında kullanılabilir (class'larda destek 5.01.07 032901 ve 5.02.03 032901'den itibaren başlar). Ayrıca, _CONSTRUCTOR ve _VARIABLES class'ında SUPER() keyword'ü yazmaya gerek yoktur, çünkü TROIA compiler varsayılan olarak base class method içeriğini override eden class'a ekler. Diğer method'lar için programcılar SUPER() keyword'ünü override eden method'a eklemelidir.Although SUPER() is usually used at the begining on overriding methods, it is also possible to use this method anywhere on overriding method. SUPER() keyword can be used in class,dialog, component and report events and codes (support on classes starts with 5.01.07 032901 and 5.02.03 032901) . Additionally, in _CONSTRUCTOR and _VARIABLES class there is no need to write SUPER() keyword because, TROIA compiler adds base class method content to overriding class as default. For other methods programmers must add SUPER() keyword to overriding method.

SUPER Object'i KullanmaUsing SUPER Object

SUPER object, TROIA programlama dilinin nispeten yeni bir feature'ıdır ve 5.01.07 032901 ve 5.02.03 032901'den sonra desteklenir. SUPER object yalnızca class'larda desteklenir. Başka bir deyişle dialog'larda, report'larda ve component'lerde desteklenmez.SUPER object is relatively a new feature of TROIA programming language and it is supported after 5.01.07 032901 and 5.02.03 032901. SUPER object is supported only classes. In other words it is not supported on dialogs,reports and components.

SUPER object, programcıların base class method'larını normal bir method gibi çağırmasına ve return değerlerini almasına olanak tanır, ayrıca programcılar çağrılan base class'ta kullanılan RETURN komutunu göz ardı edebilir. SUPER object'in kullanımı, diğer programlama dillerindeki base class identifier'larına (base, super) benzer. Daha iyi anlamak için class A'nın class B'yi inherit ettiğini ve M1 method'unu override ettiğini varsayın.SUPER object allows programmers to call base class methods as a regular method and get returning values, also programmers can ignore RETURN command which is used on called base class. Usage of SUPER object is similar to base class identifiers on other programming language (base, super). For better understanding assume class A inherits class B and overrides M1 method.

/* class B M1 method *//* class B M1 method */

PARAMETERS:PARAMETERS:

INTEGER PARAM; INTEGER PARAM;

DUMP 'B.M1';DUMP 'B.M1';

RETURN PARAM;RETURN PARAM;

/* class A M1 method *//* class A M1 method */

PARAMETERS:PARAMETERS:

INTEGER PARAM; INTEGER PARAM;

LOCAL:LOCAL:

INTEGER R; INTEGER R;

DUMP 'A.M1';DUMP 'A.M1';

R = SUPER.M1(PARAM);R = SUPER.M1(PARAM);

R = R + 1;R = R + 1;

RETURN R;RETURN R;

Bu configuration ile bir A instance'ı tanımlar ve M1 method'unu aşağıdaki kodla çağırırsanız:With this configuration if you define an A instance and call it’s M1 method with the code below:

OBJECT:OBJECT:

INTEGER RESULT, INTEGER RESULT,

A INSTANCE; A INSTANCE;

RESULT = INSTANCE.M1(10);RESULT = INSTANCE.M1(10);

Interpreter önce class A'nın M1 method'unu çağırır ve bu, class B'nin method'unu çağırır. B.M1 return ettikten sonra, sistem A.M1'in kalan kısmını normal bir function çağrısı gibi çalıştırır. Bu örnekte interpreter RESULT variable'ına 11 değerini atar. SUPER keyword'ünü daha iyi anlamak için lütfen aşağıdaki trace'i inceleyin:Interpreter firstly calls M1 method of class A and it calls method of class B. After B.M1 returns, system executes remaining part of A.M1 as a regular fuction call. In this example interpreter assigns 11 value to RESULT variable. Please review trace below for better understanding of SUPER keyword:

[DEVT11D001.RUNBUTTON.2 4] : OBJECT:[DEVT11D001.RUNBUTTON.2 4] : OBJECT:

INTEGER RESULT, INTEGER RESULT,

CLASS[A] INSTANCE; CLASS[A] INSTANCE;

(A) INSTANCE.M1.0(A) INSTANCE.M1.0

[(A) INSTANCE.M1.0 2] : PARAMETERS[(A) INSTANCE.M1.0 2] : PARAMETERS

PARAM[10] <= 10[10] PARAM[10] <= 10[10]

[(A) INSTANCE.M1.0 5] : LOCAL:[(A) INSTANCE.M1.0 5] : LOCAL:

INTEGER R; INTEGER R;

[(A) INSTANCE.M1.0 7] : DUMP 'A.M1'[(A) INSTANCE.M1.0 7] : DUMP 'A.M1'

OBJECT DUMP { Name:A.M1, Type: STRING, Value: A.M1 } OBJECT DUMP { Name:A.M1, Type: STRING, Value: A.M1 }

(A.B) INSTANCE.M1.0(A.B) INSTANCE.M1.0

[(A.B) INSTANCE.M1.0 2] : PARAMETERS[(A.B) INSTANCE.M1.0 2] : PARAMETERS

PARAM[10] <= PARAM[10] PARAM[10] <= PARAM[10]

[(A.B) INSTANCE.M1.0 3] : DUMP 'B.M1'[(A.B) INSTANCE.M1.0 3] : DUMP 'B.M1'

OBJECT DUMP { Name:B.M1, Type: STRING, Value: B.M1 } OBJECT DUMP { Name:B.M1, Type: STRING, Value: B.M1 }

[(A.B) INSTANCE.M1.0 4] : RETURN PARAM : PARAM[10][(A.B) INSTANCE.M1.0 4] : RETURN PARAM : PARAM[10]

[(A) INSTANCE.M1.0 8] : R = SUPER.M1(PARAM); [10][(A) INSTANCE.M1.0 8] : R = SUPER.M1(PARAM); [10]

[(A) INSTANCE.M1.0 9] : R = R + 1; [11][(A) INSTANCE.M1.0 9] : R = R + 1; [11]

[(A) INSTANCE.M1.0 10] : RETURN R : R[11][(A) INSTANCE.M1.0 10] : RETURN R : R[11]

[DEVT11D001.RUNBUTTON.2 6] : RESULT = INSTANCE.M1(10); [11][DEVT11D001.RUNBUTTON.2 6] : RESULT = INSTANCE.M1(10); [11]

"Cross" Nedir?What is “Cross”?

Basitçe, cross, class/dialog loader'ları tanımlanan item yerine başka bir class/dialog kullanmaya zorlayan bir tanımdır. Örneğin class A'dan class B'ye bir cross tanımlarsanız, sistem class A'nın tanımlandığı her yerde A yerine class B'yi yükler. Cross bir database record'udur ve runtime'da okunup uygulanır, başka bir deyişle compiling sürecinin bir parçası değildir. Cross'larla; standart application'ı değiştirmeye/düzenlemeye gerek yoktur, bu yüzden customer customization'ları daha az çaba ve zaman gerektirir.Simply, a cross is a definition that forces class/dialog loaders to use another class/dialog instead of defined item. For example if you define a cross from class A to class B, system loads class B instead of A anywhere class A is defined. Cross is a database record and it is read and applied on runtime, in other words it is not a part of compiling process. With crosses; there is no need to chage/modify standart application, so customer customizations need less efford and time.

Cross'lar çoğunlukla bir base class'ın yapısını/davranışını değiştiren veya bir base class'a yeni işlevsellik ekleyen inherited bir class ile kullanılır. MOVE method'u olan bir CAT class'ımız olduğunu varsayalım. Bu method, x pozisyonunu beşer beşer artırır. İşte CAT class'ının yapısının ve method'unun pseudocode'u.Crosses are mostly used with an inherited class that changes structure/behavior of a base class or adds new functionalities to a base class. Assume that we have CAT class which have a MOVE method. This method increases the x position five by five. Here is the pseudocode of the structure and method of CAT class.

class CAT:class CAT:

MEMBER: MEMBER:

INTEGER X; INTEGER X;

function MOVE function MOVE

X = X + 5; X = X + 5;

RETURN; RETURN;

/* bu kod compile edilemez,/* this code is not compilable,

sadece varsayım içindir */ it is just for assumption */

ve standart application'ın bir yerinde, CAT class'ının bir instance'ı tanımlanmış ve move method'u aşağıdaki gibi çağrılmış olsun:and in somewhere of the standart application, an instance of CAT class is defined and its move method is called like below:

OBJECT:OBJECT:

CAT RECCAT; CAT RECCAT;

RECCAT.MOVE();RECCAT.MOVE();

Ve şirketinizdeki CAT'lerin tembel olduğunu ve teker teker hareket ettiğini varsayalım. Bu durumu çözmek için tüm CAT tanımlarını bulup child LAZYCAT class'ınıza değiştirmeniz veya hangi cat type'ının oluşturulacağına karar vermek için bir factory pattern gibi bir şey yapmanız gerekir. Cross konseptiyle tüm tanımları bulup değiştirmenize gerek yoktur. CAT'ten LAZYCAT class'ınıza bir cross tanımlarsanız, sistem tüm application'larda CAT class'ı yerine LAZYCAT'i yükler. Cross çoğunlukla bir base item'dan bir child item'a kullanılsa da, bağımsız class'lar arasında bir cross tanımlamak da mümkündür (ama lütfen bağımsız item'ları cross'lamayla ilgili olası sorunları düşünün).And assume again CATs on your company are lazy and move one by one. To solve this case you must find all CAT definitions and change them to your child LAZYCAT class or do something like a factory pattern to decide which cat type will be created. With cross concept you don’t need to find and change all definitions. If you define a cross from CAT to your LAZYCAT class, system laods LAZYCAT instead of CAT class in all applications. Although cross is mostly used from a base item to a child item, it is possible to define a cross between independent classes (but please think on possible problems about crossing independent items).

Dialog'lar, class'lar, report'lar ve component'ler için cross tanımlamak mümkündür. Class'lar için cross tanımlarına genellikle "class cross", diğerlerine "dialog cross" denir.It is possible to define crosses for dialogs, classes, reports and components. Cross definitions for classes usually called “class cross” and others are called “dialog cross”.

Cross Seviyeleri & Yükleme SırasıCross Levels & Loading Order

Cross'ları iki seviyede tanımlamak mümkündür: "system cross" ve "user cross". Bir system cross sistem genelidir ve bir system cross tanımlarsanız, bu cross aynı database'e bağlanan tüm kullanıcılar için geçerlidir. User cross'lar bir kullanıcı veya bir profil için tanımlanır, bu yüzden bu tür cross'lar bir kullanıcı veya bir profilde tanımlanan kullanıcılar için geçerlidir.It is possible to define crosses in two level: “system cross” and “user cross”. A system cross is system wide and if you define a system cross, this cross is valid for all users that connects to same database. User crosses are defined for a user or a profile, so this kind of crosses are valid for a user or users defined in a profile.

Sistem; önce system cross'ları okur. System cross'lardan sonra; user cross'lar en derin profilden başlanarak okunur ve son olarak kullanıcının kendi cross'ları okunur. En son cross, önceki cross tanımlarının üzerine yazar. Başka bir deyişle, öncelik sırası kullanıcının kendi cross'ları, kullanıcının profil cross'ları, system cross'larıdır. Ayrıca cross'ları zincir olarak tanımlamak da mümkündür, işte bir zincir cross örneği:System; firstly reads system crosses. After system crosses; user crosses are read starting with deepest profile, and finally user’s own crosses are read. Latest cross owerwrites previous cross definitions. In other words, priority order is user’s own crosses, user’s profile crosses, system crosses. Also it is possible to define crosses as chain here is a chain cross sample:

A -> BA -> B

B -> CB -> C

C -> DC -> D

Cross bilgisi kullanıcı login olurken yüklenir, bu yüzden kullanıcı online iken tanımlanan/silinen cross'lar kullanıcı tekrar login olana kadar yok sayılır.Cross information is loaded while user logging in, so crosses that defined/deleted while user online are ignored until user login again.

Bir cross'u kaldırmak için item'ın kendisinden bir cross tanımlayabilirsiniz (A -> A). Ama birden fazla adımda cross'ları sonsuz bir loop olarak tanımlamak TROIA seviyesi bir hata sayılır ve login'de stackoverflow hatasına veya sonsuz loop'a neden olabilir. İşte geçersiz bir cross tanımı:To remove a cross you can define a cross from item’s itself (A -> A). But defining crosses as an infinite loop in more than one step is considered as TROIA level error and this may cause stackowerflow error or infinite loop on login. Here is an invalid cross definition:

A -> BA -> B

B -> CB -> C

C -> AC -> A

Cross'lar Nasıl TanımlanırHow to Define Crosses

Class'lar için, system cross'lar "DEVT08 - Class Dynamic Link" transaction'ında tanımlanır. Bir class için system cross tanımlamak için gereken tek data, cross'layan ve cross'lanan class'ın isimleridir. Class'lar için system cross tanımları SYSCLSREF system table'ında saklanır. Dialog'lar, report'lar ve component'ler için cross tanımlamak üzere "DEVT09 - Dialog Dynamic Link" transaction'ı kullanılır ve bu transaction cross tanımlarını saklamak için SYSDLGREF system table'ını kullanır.For classes, system crosses are defined in “DEVT08 - Class Dynamic Link” transaction. To define a system cross for a class required data is only names of crossing and crossed class. System cross definitions for classes are stored in SYSCLSREF system table. To define cross for dialogs, reports and components “DEVT09 - Dialog Dynamic Link” transaction is used and this transaction uses SYSDLGREF system table to store cross definitions.

Kullanıcılar ve kullanıcı profilleri için; cross'lar "SYS03 - User Login Info" transaction'ının "Class Reference" ve "Dialog Reference" tab'larında tanımlanır. User cross tanımları IASUSERCLSREF ve IASUSERDLGREF table'larında saklanır. Görüldüğü gibi; tüm user cross'ları user tanımıyla ilişkilidir ve user silindiğinde, tüm cross tanımları silinir.For users and user profiles; crosses are defined in “Class Reference” and “Dialog Reference” tabs of “SYS03 - User Login Info” transaction. User cross definitions are stored in IASUSERCLSREF and IASUSERDLGREF tables. As it is obvious; all user crosses are related with user definition and when user is deleted, all cross definitions are deleted.

Örnek 1: Class Inherit Etme ve Method Override EtmeExample 1: Inheriting Class and Overriding Methods

Base class olarak bir animal class'ı oluşturun. Bir animal;Create an animal class as a base class. An animal;

Animal'ı inherit eden bir child cat class'ı oluşturun. Bir cat;Create a child cat class that inherits animal. A cat;

Cat class'ını inherit eden bir child cheetah class'ı oluşturun. Bir cheetah;Create a child cheetah class that inherits cat class. A cheetah;

Bir cat ve bir cheetah oluşturan, MOVE ve JUMP method'larını çağıran ve x ile y pozisyonlarını karşılaştıran TROIA kodu yazın.Write TROIA code that creates a cat and a cheetah call their MOVE and JUMP methods and compare their x and y position.

OBJECT: OBJECT:

RDCAT CAT1,RDCAT CAT1,

RDCHEETAH CHEETAH1;RDCHEETAH CHEETAH1;

CAT1.WALK(); CAT1.WALK();

CAT1.JUMP(); CAT1.JUMP();

CHEETAH1.WALK(); CHEETAH1.WALK();

CHEETAH1.JUMP(); CHEETAH1.JUMP();

STRINGVAR2 = CAT1@XPOSITION + '-' + CAT1@YPOSITION; STRINGVAR2 = CAT1@XPOSITION + '-' + CAT1@YPOSITION;

STRINGVAR3 = CHEETAH1@XPOSITION + '-' + CHEETAH1@YPOSITION; STRINGVAR3 = CHEETAH1@XPOSITION + '-' + CHEETAH1@YPOSITION;

Örnek 2: Cross Sırasını AnlamakExample 2: Understanding Cross Order

User profile'ı P1 olan ve P1'in base profile'ı P0 olan bir U1 kullanıcısı olduğunu varsayın. Cross tanımları aşağıdaki gibidir:Assume a U1 user whose user profile is P1 and P1’s base profile is P0. Cross definitions are like below:

SYSTEM : A -> BSYSTEM : A -> B

SYSTEM : C -> DSYSTEM : C -> D

SYSTEM : E -> FSYSTEM : E -> F

SYSTEM : G -> HSYSTEM : G -> H

P0 : K -> LP0 : K -> L

P0 : A -> NP0 : A -> N

P1 : A -> XP1 : A -> X

P1 : C -> CP1 : C -> C

U1 : A -> YU1 : A -> Y

U1 : F -> ZU1 : F -> Z

Kullanıcı için nihai cross tablosu nedir?What is the final cross table for the user?