# construct

**URL:** <https://www.dynamicsuser.net/t/construct/41824>\
**Category:** Developer Forum\
**Created:** [November 27, 2012, 11:17am UTC](https://www.dynamicsuser.net/t/construct/41824 "2012-11-27T11:17:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![srikanth\_konda](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@srikanth\_konda](https://www.dynamicsuser.net/u/srikanth_konda)\
**Post date:** [November 27, 2012, 11:17am UTC](https://www.dynamicsuser.net/t/construct/41824/1 "2012-11-27T11:17:10Z")

</div>

what is the purpose of construct method, which cannot be done by the new method. can anyone please explain with example in terms of layman.

---

<div class="post-metadata">

**Author:** ![MartinDrab](https://avatars.discourse-cdn.com/v4/letter/m/e0b2c6/32.png) [@MartinDrab](https://www.dynamicsuser.net/u/MartinDrab)\
**Post date:** [November 27, 2012, 12:59pm UTC](https://www.dynamicsuser.net/t/construct/41824/2 "2012-11-27T12:59:08Z")

</div>

I plan (for a long time already) to write an article about construct(). Unfortunately I haven’t done it so far…

Very briefly: Imagine you have a system class (SysClass) and you would like to extend it by your children class (MyClass extends SysClass) and use MyClass instead of SysClass everywhere.

If SysClass is constructed by a constructor (new()), you have to find all such places and replace _new SysClass()_ with _new MyClass()_. If it used construct() method, you would replace just a single place - the constructor call in construct(). You can do more things in the construct() method, if you want, e.g. choosing the actual type to be constructed based on a condition.
