tag:blogger.com,1999:blog-66360159077376819472024-03-08T02:29:09.117-08:00Coding for Allarunhttp://www.blogger.com/profile/16479455378569558007noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-6636015907737681947.post-68203816154222218552008-07-30T22:21:00.000-07:002008-07-30T22:51:11.123-07:00C# : Reference of Abstract class containing derived class instance<P>You could have seen a object initialization like this<br /> </P><br /> <P>A a = new B();<br /> </P><br /> <P>where B is a derived class of A. But we cannot do the other way around.<br /> </P><br /> <P>B b = new A(); // because A is an abstract class<br /> </P><br /> <P>Take a look into the below example and its output.You can understand how it <br /> works.</P><br /> <P><br /> <br><br /> <div style="BACKGROUND-COLOR: gray" rows="20" cols="70" readonly><br />using System;<br />using System.Text;<br /><br />namespace aruns_code<br />{<br /> class testAbstract<br /> {<br /> [STAThread]<br /> static void Main(string[] args)<br /> {<br /> der derObj = new der();<br /> derObj.nonAbs();<br /><br /> Console.WriteLine("\n\n");<br /><br /> abs absObj = new der();<br /> absObj.nonAbs();<br /> absObj.absMethod();<br /> }<br /> }<br /><br /> class der : abs<br /> {<br /> public der()<br /> {<br /> Console.Write("initialized der\n");<br /> }<br /><br /> public override void absMethod()<br /> {<br /> Console.Write("inside der\n");<br /> }<br /><br /> public new void nonAbs()<br /> {<br /> Console.Write("inside nonAbs of der\n");<br /> }<br /> }<br /><br /><br /> abstract class abs<br /> {<br /> public abs()<br /> {<br /> Console.Write("initialized abs\n");<br /> }<br /><br /> public abstract void absMethod();<br /><br /> public void nonAbs()<br /> {<br /> Console.Write("inside nonAbs of abs\n");<br /> }<br /> }<br /><br />}<br /></div><br /><br /><br><br />The following is the output<br /><br><br /><br /><div readonly style="BACKGROUND-COLOR: gray" rows="10" cols="70"><br />initialized abs<br />initialized der<br />inside nonAbs of der<br /><br />initialized abs<br />initialized der<br />inside nonAbs of abs<br />inside der<br /></div><br /></P>arunhttp://www.blogger.com/profile/16479455378569558007noreply@blogger.com0tag:blogger.com,1999:blog-6636015907737681947.post-49542358706663775142007-11-01T00:45:00.000-07:002007-11-01T00:49:42.907-07:00Introduction to MONO.netHave you ever thought of installing and running ASP.NET web application on linux?Yes. it is made possible using <a href="http://www.mono-project.com/Main_Page" rel="nofollow">MONO framework</a>. It is actually an open source implementation of .NET framework. It emulates .NET framework. So you can write your codebehind in C#.net just like you were writing for your usual ASP.NET application and compile it. Now put up a linux box with mono in it. Now you can install and run your ASP.NET application straight from the linux box!! It is really great!!arunhttp://www.blogger.com/profile/16479455378569558007noreply@blogger.com1tag:blogger.com,1999:blog-6636015907737681947.post-31088101340076770332007-05-16T02:24:00.000-07:002007-05-16T02:32:18.553-07:00How to remove all options from a list box using javascript?<code><pre class="code"><br /> function clearListBox(listboxID)<br /> {<br /> // returns 1 if all items are sucessfully removed<br /> // otherwise returns zero.<br /> var mylistbox = document.getElementById(listboxID);<br /> if(mylistbox == null)<br /> return 1;<br /> while(mylistbox.length > 0)<br /> {<br /> mylistbox.remove(0);<br /> }<br /> return 1;<br /> }<br /></pre></code>arunhttp://www.blogger.com/profile/16479455378569558007noreply@blogger.com3tag:blogger.com,1999:blog-6636015907737681947.post-52291662003808735882007-05-16T02:23:00.000-07:002007-11-01T00:45:51.328-07:00about meI am a software engineer from India...<br />Coding was my hobby...<br />now, Coding is my profession...arunhttp://www.blogger.com/profile/16479455378569558007noreply@blogger.com0