Interface and Abstract class, inheritance, abstraction with
examples. Polymorphism (difference betn overloading and
overriding

Answers were Sorted based on User's Feedback



Interface and Abstract class, inheritance, abstraction with examples. Polymorphism (difference bet..

Answer / alb.shah

Abstract class:
Abstract class act as base class, not instantiable, no
implementaiotn in base class but allow implementaiotn in
derived class with overide method, method must be abstract.
specially used in inheritance.

Interface:

Interface class dont have constructor, destructor,
always public modifier set to true
no implementation
cant used multiple inheritance instead of this we use
multiple interface

Inheritance :

In Inheritance we can use one class property into another
class..
using System;
class sample
{
public void display()
{
Console.WriteLine("C#");
}
}
class sample1:sample
//(Inheriting the property of class sample in class sample1)
{
public void disp()
{
Console.WriteLine("C++");
}
}
class Test
{
public static void Main()
{
sample1 sm=new sample1(); //creating a object of sample1
sm.display(); //accessing function of sample class
sm.disp();
}

Abstraction :

"Abstraction" simply means showing only those details to
the user which are of use to them , and hiding up the
unnecessary
Abstraction is the process or result of generalization by
reducing the information content of a concept or an
observable phenomenon

polimorphism :

polimorphism is the one of the oops features, allows one
object to appear in different form by changing the type.

Two types:
1- Static eg:method overloading
2- Dynamic eg:method overriding

difference betn overloading and overriding :

OverLoading means one name many forms .its functionallty
changes corresponding to the objects
Overriding means its funcationality can be overrided.these
can be done by using by using two keywords
1.overrideable
2.overrides
overriding take place with in the in_heritance. it is not
possiable with in the class.

Is This Answer Correct ?    6 Yes 0 No

Interface and Abstract class, inheritance, abstraction with examples. Polymorphism (difference bet..

Answer / amey

Interface and Abstract class both derived from Method.If u call Abstract class then u have to call all the method of Abstract class but I u call Interface then need not call all the method of Interface.

Inheritance means it is a mechanism of design or construction
from one class to another.

Polymorphism means It is the ability take more than one form.

overloading means same name, different parameter.

overriding means different name, parameter may be different.

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More ASP.NET Interview Questions

What is a session http?

0 Answers  


What is the purpose of session management?

0 Answers  


How to display Alert in ASP.NET

0 Answers   HCL,


What?s the difference between Response.Write() andResponse.Output.Write()?

7 Answers   Atos Origin, IBM,


Can you explain what inheritance is and give an example of when you might use it?

1 Answers  






code for "For every 5days system has to create 1text file with the corresponding date and it has to store in c-drive" by using web applications

0 Answers  


suppose we have two object;obj1 and obj2 can we assign obj2 to one1; and if yes; then after assigning suppose we delete obj2 then obj1 will retain obj2 value or not.

3 Answers  


Question asked by one of interviewer in panal is given below: We have 2 user control on same page ,1st user control contains textbox and a button while 2nd user control have label. when ever we click on button click of 1st custom control button the value of the textBox will get updated into Label of 2nd custom control. How to do this.Your help will be appreciated.

1 Answers  


Is asp.net and .net the same?

0 Answers  


You are planning the deployment of an ASP.NET application. The application uses a Visual Studio .NET component named DataAccess that will be shared with other applications on your Web server. You are using Visual Studio .NET to create a Windows Installer package. You need to deploy DataAccess and the ASP.NET application so that they can be uninstalled later of necessary. What should you do? A . Create a setup project for DataAccess. Add the ASP.NET application in a custom action. B . Create a setup project for the ASP.NET application. Create another setup project for DataAccess. C . Create a Web setup project for the ASP.NET application. Add a project output for DataAccess. D . Create a Web setup project for the ASP.NET application. Add a merge module for DataAccess.

3 Answers   Syntax Softtech,


How does asp net store session ids by default?

0 Answers  


Hi this is the coding for adding data in to an xml table i want the coding for update and delete Try Dim emp_xml_doc As New XmlDocument If System.IO.File.Exists(Server.MapPath("emp.xml")) Then emp_xml_doc.Load(Server.MapPath("emp.xml")) Dim myrow_element As XmlElement myrow_element = emp_xml_doc.CreateElement("EmpDetails") Dim str As String str = "<EmpID>" & TxtEmpId.Text & "</EmpID>" & _ "<Empname>" & TxtName.Text & "</Empname>" & _ "<EmpSalary>" & TxtSalary.Text & "</EmpSalary>" myrow_element.InnerXml = str emp_xml_doc.DocumentElement.AppendChild(myrow_element) emp_xml_doc.Save(Server.MapPath("emp.xml")) Response.Write("Record Saved") Dim ds As New DataSet ds.ReadXml(Server.MapPath("emp.xml")) GridView1.DataSource = ds GridView1.DataBind() Else Response.Write("File does not exist.") End If Catch ex As Exception Response.Write(ex.ToString) End Try *********************** this is the xml file <?xml version="1.0" encoding="utf-8" ?> <Employee> <empdetails> <empid>100</empid> <empname>xxx</empname> <empsalary>2000</empsalary> </empdetails> <EmpDetails> <EmpID>yyy</EmpID> <Empname>dddd</Empname> <EmpSalary>77777</EmpSalary> </EmpDetails> <EmpDetails> <EmpID>rrrr</EmpID> <Empname>rrrr</Empname> <EmpSalary>6666</EmpSalary> </EmpDetails> <EmpDetails> <EmpID>qaqa</EmpID> <Empname>sini</Empname> <EmpSalary>50000</EmpSalary> </EmpDetails> <EmpDetails> <EmpID>errrrrrrrr</EmpID> <Empname>rrrrrrrrr</Empname> <EmpSalary>677777</EmpSalary> </EmpDetails> <EmpDetails> <EmpID>rrr</EmpID> <Empname>rrr</Empname> <EmpSalary>33</EmpSalary> </EmpDetails> </Employee>

0 Answers   InfoCom,


Categories