Tuesday, 7 January 2014

Abstract Modifier in ax 2012


Abstract Modifier
An abstract class or method is the exact opposite of a final. The use of abstract classes is
a way of planning inheritance as it forces creating a subclass for using the class, as an
abstract class cannot be declared. This is often used in the standard package for super
classes to control that the super class is not declared by mistake. The class
SalesFormLetter which is used for creating documents such as sales confirmations and
sales invoices uses this practice. The class has an construct() method which should be
used, and to prevent the class being declared using new() SalesFormLetter is qualified
as abstract.
abstract CustAccount myAbstractMethod()
{
// The code in this method is never executed
#if.never
select firstonly custTable
where custTable;
#endif
}
Methods can be declared as abstract, but only if the class is abstract. An abstract method
must be overridden as an abstract method cannot have a code block. Abstract methods
contains only a parameter profile. You can however use the macro call #if.never to add
"code" to an abstract method. This will help clarify why this method must be overridden
in the subclass. You might wonder why you should not simply add comments in the
abstract method. The point is that code within the macro call is shown in color as with
any other code in the editor making it easier to differentiate comments and code. Note
that no validation is done on code written in the #if.never macro so anything could be
written. It is optional to qualify methods of an abstract class as abstract. For this reason
you will still be able to add variables in the ClassDeclaration of an abstract class..
The access modifiers protected can be use with abstract methods. An abstract method
cannot be static, as the static methods only exist in the super class

No comments:

Post a Comment

SQL/SSRS Interview questions I thought of blogging some SQL/SSRS interview questions.

Below are some. I will add more, when I complete the compilation 1. What is OLTP(Online Transaction Processing)? OLTP stands ...