Você está na página 1de 4

interface CanFight {

void fight();
}

interface CanSwim {
void swim();
}

interface CanFly {
void fly();
}

class ActionCharacter {
public void fight() {
}
}

class Hero extends ActionCharacter implements CanFight, CanSwim, CanFly


{
public void swim() {
}

public void fly() {


}
}

public class Adventure {


public static void t(CanFight x) {
x.fight();
}

public static void u(CanSwim x) {


x.swim();
}

public static void v(CanFly x) {


x.fly();
}

public static void w(ActionCharacter x) {


x.fight();
}

public static void main(String[] args) {


Hero h = new Hero();
t(h); // Treat it as a CanFight
u(h); // Treat it as a CanSwim
v(h); // Treat it as a CanFly
w(h); // Treat it as an ActionCharacter
}
} ///:~
Difference..
String..
1.Its a class used to handle strings.
2.Here concatenation is used to combine two strings.
3.String object is used to concatenate two strings.
4.The first string is combined to the other string by creating a new copy in the memory as a string object,
and then the old
string is deleted
5.we say "Strings are immutable".

String Builder..
1.This is also the class used to handle strings.
2.Here Append method is used.
3.Here, Stringbuilder object is used.
4.Insertion is done on the existing string.
5.Usage of StringBuilder is more efficient in case large amounts of string manipulations have to be
performed

user control
1)it extension is .ascx.
2)it can be more than one on single web page.
3)it doesn't contain Contentplaceholder.
4)it doesn't work like a fixed template.it can be
display in diffrent manner in diffrent page.
MasterPage:
1) it extension is .Master.
2)it used like a template.
3)it contain ContentPlaceHolder.

Generics are the new feature in the c# 2.0. They introduce the concept of Type parameter.
This makes it possible to classes and methods that differs the specification of one or more
types until the class or method is declared and used by the code, which will be using it.

Generic helps us to maximize the reuse of code, Type safety and better performance.
Generics are most commonly used to create a collection. There are many new generic
collection classes in the System.collection.Generics namespace. These classes are advised
to be used for type safety and better performance over araylist.

We can also create our own Generic interface, classes, methods, events and delegates.
Information on the types used in a generic data type may be obtained at run-time by
means of reflection

We can declare a generic class like this


public class GenericClass<T>
{

void Add(T input) { }

We create an instance of the generic class like this

GenericClass<string> list2 = new GenericClass<string>();

Here if want we can also initialize the class to be of any other type like a user defined
class. For example

Public class test


{

Pubic class TestClass{}

GenericClass<TestClass> list2 = new GenericClass<TestClass>();

one of the most simple, versatile and effective languages used to extend functionality in websites. Uses
range from on screen visual effects to processing and calculating data on web pages with ease as well as
extended functionality to websites using third party scripts among several other handy features, however
it also possesses some negative effects that might make you want to think twice before implementing
Javascript on your website. Let's look at some of its pros and cons.

Advantages
• Javascript is executed on the client side
This means that the code is executed on the user's processor instead of the web server thus
saving bandwidth and strain on the web server.

• Javascript is a relatively easy language


The Javascript language is relatively easy to learn and comprises of syntax that is close to
English. It uses the DOM model that provides plenty of prewritten functionality to the various
objects on pages making it a breeze to develop a script to solve a custom purpose.

• Javascript is relatively fast to the end user


As the code is executed on the user's computer, results and processing is completed almost
instantly depending on the task (tasks in javascript on web pages are usually simple so as to
prevent being a memory hog) as it does not need to be processed in the site's web server and
sent back to the user consuming local as well as server bandwidth.

• Extended functionality to web pages


Third party add-ons like Greasemonkey enable Javascript developers to write snippets of
Javascript which can execute on desired web pages to extend its functionality. If you use a
website and require a certain feature to be included, you can write it yourself and use an add-on
like Greasemonkey to implement it on the web page.

Disadvantages
• Security Issues
Javascript snippets, once appended onto web pages execute on client servers immediately and
therefore can also be used to exploit the user's system. While a certain restriction is set by
modern web standards on browsers, malicious code can still be executed complying with the
restrictions set.

• Javascript rendering varies


Different layout engines may render Javascript differently resulting in inconsistency in terms of
functionality and interface. While the latest versions of javascript and rendering have been
geared towards a universal standard, certain variations still exist. Website Usability Consultants
all over the world make a living on these differences, but it enrages thousands of developers on
a daily basis.

Você também pode gostar