Saturday, October 17, 2015

Constructors and Destructors

Constructors:
1. Constructor is a special method of a class which will invoke automatically whenever instance or object of class is created.
2. It can't return any value
3. C# supports overloading of constructors
4. You can always make a call to one constructor from within another.
5. There can be only one static constructor in the class.
6. The static constructor should be without parameters and  it can only access the static members of the class.
7. There should be no access modifier in static constructor definition.
8. In inheritance base class constructor get called first.
9. It is mandatory to have the constructor in the class.
10. In case if we do not write constructor, the compiler will try to supply the no parameter constructor for your class.
11. We can neither create the object of the class, nor can we inherit the class with only private constructors.
12. We access static members from the non-static (normal) constructors,there is no such restriction on non-static constructors. But there is one on static constructors that it can access only static members.

Destructors:
1. A destructor is a member that implements the actions required to destruct an instance of a class.
2. A class can only have one destructor.
3. Destructors cannot be inherited or overloaded.
4. Destructors cannot be called. They are invoked automatically. 
5. A destructor does not take modifiers or have parameters.

Tuesday, December 16, 2014

Compare two dates in javascript



if (new Date(First_date) > new Date(SecondDate)) {
                       

//compare end <=, not >=
    //your code here


                     }