On Sep 12, 1:35*pm, pinki panda wrote:
i want to knw the diff between static class and abstract class .i would appreciate if its followed by example
An abstract class is one which can't be directly instantiated. It
usually has some abstract methods which must be implemented by classes
further down the hierarchy:
public abstract class Foo
{
public abstract void DoSomething();
public void NormalMethod()
{
DoSomething();
}
}
A static class is one which can never be instantiated. You can't use
this as the type of a parameter, or a variable, or a type parameter.
It has no constructors (unlike normal classes, which gain a public
parameterless constructor automatically if you don't specify any
constructors). It's not allowed to have any instance members. It's
usually used for "helper methods". Extension methods (new to C# 3.0)
have to be in non-nested static classes.
public static class StringUtil
{
public static string Reverse(string original)
{
// Whatever
}
}
Jon