function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Surendra nuneSurendra nune 

Side affects of initialising constructor of a controller.

Hi,

I have two visualforce pages PageA,PageB and their respective controllers PageActrl, PageBCtrl .
What are the side affects of initialising PageActrl constructor in pageBCtrl?
ManojjenaManojjena
Hi Surendra ,

While loading the page constuctor of the class related to the page will instantiate and create a object in heap . If you will instantiate another class constuctor in the current class it will also create an object in heap .
Problem may occur if you have query in both constructor then it may throw   the view state exception if you have form tag in VF page .
Surendra nuneSurendra nune
Are there any other alternatives to do this apart from static method?