By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,725 Members | 1,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,725 IT Pros & Developers. It's quick & easy.

i want to knw the diff between static class and abstractclass .i would appreciate if its followed by example

P: n/a
i want to knw the diff between static class and abstract class .i would appreciate if its followed by example
Sep 12 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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
How about the RTFM?
Try to create and compile and run them...
Sep 12 '08 #2

P: n/a
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
Sep 12 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.