You need to sign in to do that
Don't have an account?
sfdc fresher
what is the use of writting the code in constructor and use that class in vf pages
hi folks,
could any one please explain me :
when we write the code in the constructor, once we create the object automatically consturctor called.
But what is the use if we use that class in Visualforce page as controller, we dont create any object there right?
what if we write the code in constructor. Could anyone please explain me.
I see below code ,what happens when we write this.
public AccountAndContacts()
{
accs=new Account();
cts=new list<Contact>();
add();
}
Thanks...
could any one please explain me :
when we write the code in the constructor, once we create the object automatically consturctor called.
But what is the use if we use that class in Visualforce page as controller, we dont create any object there right?
what if we write the code in constructor. Could anyone please explain me.
I see below code ,what happens when we write this.
public AccountAndContacts()
{
accs=new Account();
cts=new list<Contact>();
add();
}
Thanks...
and in your above code we just instantiate our variables on page load.
Thanks , let us know if it helps you
You are right that we don't create an object of the controller class on VF page explictly but what happens is an object is implictly created whenever that VF page is rendered.