Hi,
Below is the way to implement overriding in JS. The major use of this comes while working with Master & User Controls.
<script type="text/javascript">
function Base()
{
this.OverrideMe = function()
{
alert("Base::Override()");
}
this.BaseFunction = function()
{
alert("Base::BaseFunction()");
}
}
function Derive()
{
this.OverrideMe = function()
{
alert("Derive::Override()");
}
}
function CallOveride()
{
Derive.prototype = new Base(); // Required only when u want to call some base class fucntions as well. This must be the first statement.
d = new Derive();
d.OverrideMe();
d.BaseFunction();
d = new Base();
d.OverrideMe();
}
</script>
Thanks & Regards,
Arun Manglick
SMTS || Microsoft Technology Practice || Bridgestone - Tyre Link || Persistent Systems || 3023-6258
DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.
No comments:
Post a Comment