Friday, May 29, 2009

# IS-A relationship. # e.g. Student IS A Person, Employee IS A Person. # cannot be instantiated. # normally used for framework-type library classes: providing default behavior for some of its class members, but forcing the developer to implement

others. # It has to be inherited for use . # You need to INHERIT to use an abstract class. # Attempting to instantiate an object of an abstract class retults in a compilation error # Any Class with abstract method or property in it must be declared abstract # Abstract will allow you to set the access specifier. Ex:- (private,public, protected, internal). # Abstract will allow you to implement the body in abstract methods. # Situation where functionality may add/remove "Abstract Class" is best solution. # Eg. Creating Base Classes,Creating Base for your project where functionality may be added or remove or can be override if needed.Mostly common task are

move to base class and if required than can be overrided.

# in Abstract class you can Declare the Constructors,fields,methods,indexes,destructors etc

# practical example for abstract class:

we can use account class in bank as abstract class.inreality

there will be no account we can use .but only sbaccount and current account will be exist.so we can use account class as abstract

class and we can inherits this class in sbaccount class,current account class

2. Abstract Class: Allows common functionality to be shared across similar objects

Of course, don't use an abstract class in cases where functionality doesn't need to be shared.

Interface:

# CAN-DO relationship. # e.g. Student CAN enrol, Student CAN submit assignment. # cannot be instantiated. # group of related methods with empty bodies . # You need to IMPLEMENT to use an interface.

# The implementation of an interface is left completely to the developer. # Interfaces can contain only the signature of a method but no body. # Interfaces are used to declaring functionality. # By default all interface methods are public. # Situation where we have fix requirement "Interface" is best solution. # Eg. Plugin .Where Pluging can be loaded dynamically and executes its functionality.Thus that Plugin must follow or implement certain functionality. # In class you can implement the interface method, but can’t implement the body in Interface method. # in interface you can not Declare the Constructors,fields,methods,indexes,destructors # Examples:'//mutltiple inhiritanceInterface IA{void cat();void Dog();}Interface IB{void door();void tyres();}public class C:IA,IB{public void cat(){Console.WriteLine("hello cat method");}public void dog(){Console.WriteLine("hello dog method");}public void door(){Console.WriteLine("hello door method");}public void tyres(){Console.WriteLine("hello tyres method");}}

Exp : 1. Interfaces are useful when you do not want classes to inherit from unrelated classes just to get the required functionality. For example, let bird

be a class with a method fly(). It will be ridiculous for an aeroplane to inherit from bird class just because it has the fly() method. Rather the fly()

method should be defined as an interface and both bird and aeroplane should implement that interface.

Exp 2. Hi what suits my case !! Say a real estate builder is constructing an apartment with many flats.All the rooms in the flats have the same design,except

the bedroom. The bedroom design is left for the ppl who would own the flats i.e; the bedRooms can be of different designs for different flats. I can achieve this through an abstract class like below:

# Interface is without implementation, just interface or virtual methods.

# As per my understanding, it is can-do or is-do relationship. Like, from .NET framework, there are many interface like IComparer, ISortable etc. So, it is

something like, classes derived from the interface CAN-DO these things.

Defference :

# A class can inherit one or more interfaces, but only one abstract class.

# An abstract class can have abstract members as well non abstract members. But in an interface all the members are implicitly abstract and all the members

of the interface must override to its derived class.

# The members of the interface are public with no implementation. Abstract classes can have protected parts, static methods, etc.

# Interface are similar to abstraction classes.However , interfaces represent the higest level of abstraction in Object- oriented programming.This is because

all the methods in an interface are abstract and do not have implementation.In contrast ,the abstract classes might contain a method that has a body.

# 1).Interface have only signature. whereas Abstract class have signature and definition both r allow. 2). Interface have not allow modifier access. whereas

Abstract class are allowed modifier access. 3).Thurogh the Interface we can create the Multiple Inheritance whereas Abstract class are not allow the Multiple

Inheritance. 4).Interface is slower compare Abstract class.

# An abstract class may contain complete or incomplete methods. Interfaces can contain only the signature of a method but no body. Thus an abstract class can

implement methods but an interface can not implement methods. · An abstract class can contain fields, constructors, or destructors and implement properties.

An interface can not contain fields, constructors, or destructors and it has only the property's signature but no implementation. · An abstract class cannot

support multiple inheritance, but an interface can support multiple inheritance. Thus a class may inherit several interfaces but only one abstract class. · A

class implementing an interface has to implement all the methods of the interface, but the same is not required in the case of an abstract Class. · Various

access modifiers such as abstract, protected, internal, public, virtual, etc. are useful in abstract Classes but not in interfaces.

# Interface:- 1. Interfaces are used to declaring functionality. 2. By default all interface methods are public. 3. In class you can implement the interface

method, but can’t implement the body in Interface method. Abstract:- 1. Abstract will allow you to set the access specifier. Ex:- (private,public, protected,

internal). 2. Abstract will allow you to implement the body in abstract methods. 3. You can inherit the abstract methods in classes

# • Abstract ClassCannot be instantiated.Must be inherited and its methods should be overridden.It have some concreate methods. Access modifiers allowed.

• InterfaceHave definition of a method not implementation. (implement through class)Multiple inheritance possible through Interface onlyOnly Public Access modifier only allowed. Defaultly PublicNo need of virtual overridden.It’s used for to define a set of properties, methods and events.

Que: What is WSDL ?Answer: WSDL stands for Web Services Description Language, a standard by web services can tell clients what messages it accepts and which results it will return. It provides you information on the classes and methods that are supported by a particular web services.

Que : What is UDDI ?Ans: UDDI is Universal Description, Discovery and Integration Language. UDDI allow you to find web services by connecting to a directory. It is a directory that can be used to publish and discover public web services.

Que: Explain Unmanaged Environment From Dot Net Framework.Answer : Code that does not operate within the CLR is called unmanaged code. Unmanaged code does not get benefits offered by CLR including garbage collection, memory management, security, etc. Exp. COM component are unmanaged code.

Que: What is Event Bubbling?Answer: Server control like Data Grid, Datalist, Repeator can have other child controls inside them. Exp Datagrid can have conbo box inside datagrid.Thise child control do not raise there event by themselves , rather they pass the event to the container parent (which can be a daragrid, datalist, repeater) , which passes to the page as “Itemcommand “ event. As the child control send there event to parent this is termed as event Bubbling.

Pages

Love and Sad Poems !

What does Yor Hand Says !

Grand Mother's Stories !

About Me

Devesh , Palm Reader, writes about all things related to palmistry, including history, tips on reading, and life as a professional palmist, software engineer and poet.
You can contact me : 09911360392
Mail Id :palmreading007@gmail.com, dev2mail@yahoo.co.in