Saturday, 22 November 2014

Difference between New() and Construct()

Construct:
This method returns an instance of a class, it is a best practice to have a construct method in your class.

This method should be static but can be private or private depending on case, when calling a class from another class or job construct method can be use for this.

New:
This method is default constructor of a class, Invokes when user uses a "new" keyword.

Mostly it is protected.


2 comments:

  1. Please elaborate this when a static constructor will be called ? is it with New() or Construct, or does AX have static constructor

    ReplyDelete