IS CONSTRUCTOR override,
is static CONSTRUCTOR overload and
Is static CONSTRUCTOR override in asp.net;
why we use sessions and cookies in asp.net only;
what actual difference bitween autopostback, Ispostback plz give answers;
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Oct 14, 2012, 9:59 AM
A static constructor always takes this form:
static SomeClass()
{
// code
}
It is always parameterless and can never therefore be overloaded.
Shivanand ArurPosted Oct 14, 2012, 8:13 AM
Hello Veera. Basically a Constructor is called when an Object is created....
eg: myClass object1 = new myClass(); // Here the Constructor is called.
Constructor Overloading :
A Constructor can be overloaded. By the term overload, I mean when we create an Object, then multiple types of parameters can be passed in the constructor for the same object. Take a look at the example.
eg1 : myClass object1 = new myClass(int age);
eg2 : myClass object2 = new myClass(int age, string name);
eg3 : myClass object3 = new myClass(int age, string name, string designation);
So as you can see in the example. I am creating Objects of the same class, but they take different parameters and play a different role in each type of parameter. So this is Constructor Overloading.
Constructor Overriding :
Overriding is usually used in case of methods. Take a look at this example...
Class A
{
public virtual void MyA()
{
Console.WriteLine("This is my A Class method");
}
}
Class B : A
{
public override void MyA()
{
Console.WriteLine("This is my B Class method");
}
}
Class MyClass
{
public static void Main()
{
A ObjA = new A();
B ObjB = new B();
A.MyA(); // O/p - This is my A Class method
B.MyA(); // O/p - This is my B Class method
}
}
So Overriding is usually used in Case of methods.... Overriding of Constructors is not possible and does not makes any sense, since each object created, the Constructor is called again and again. If different parameters are passed, the Constructors in different way.
Static Constructors :
http://www.dotnetperls.com/static-constructor
http://www.c-sharpcorner.com/UploadFile/cupadhyay/StaticConstructors11092005061428AM/StaticConstructors.aspx
Why we use Sessions and Cookies in asp.Net?
Check out this link...
http://www.c-sharpcorner.com/UploadFile/78d182/Asp-Net-state-management-techniques/
Autopostback and IsPostback :
Check out these links :
http://dotnet.tekyt.info/?p=30
http://www.codeproject.com/Articles/68371/Detecting-Refresh-or-Postback-in-ASP-NET
http://in.answers.yahoo.com/question/index?qid=20090528223458AAlk7cJ
PLEASE MARK THIS ANSWER AS CORRECT IF IT HELPED YOU!!!
THANK YOU!!!
Satyapriya NayakPosted Oct 14, 2012, 6:59 AM
Please refer the below links
http://www.c-sharpcorner.com/UploadFile/puranindia/constructors-in-C-Sharp/
http://www.codeproject.com/Articles/7011/An-Intro-to-Constructors-in-C
http://www.c-sharpcorner.com/forums/thread/140405/Controls/NewControls/
http://exploreasp.blogspot.in/2011/04/what-is-difference-between-autopostback.html
http://www.codeproject.com/Articles/244904/Cookies-in-ASP-NET
http://asp.net-tutorials.com/state/sessions/
Thanks
If this post helps you mark it as answer