473,396 Members | 2,059 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

i want to knw the diff between static class and abstract class .i would appreciate if its followed by example
Sep 12 '08 #1
2 1813
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: sam | last post by:
Hi, I've written the following static class definition : #ifndef __AUTH__ #define __AUTH__ #include <iostream> #include <string> #include <fstream>
9
by: Neil Kiser | last post by:
I'm trying to understand what defining a class as 'static' does for me. Here's an example, because maybe I am thinking about this all wrong: My app will allows the user to control the fonts...
3
by: Amy L. | last post by:
I have a method below called "ResolveHostname" which is called from the ThreadPool.QueueUserWorkItem. My concern is with the static dnsClient class where I am calling dnsClient.Lookup( Hostname)...
15
by: ad | last post by:
We can define a static member in a class. But can we define a static class, so that all members are static?
15
by: DBA | last post by:
Hi All, What is the diff. between a singleton class and a static class in C#?
2
by: msaladin | last post by:
Hi all, I spent today with finding an error, I found it, though I don't no why. I have a class with static constants, like this: class EXPORT_API BusConstants { public: static const...
11
by: Raja Chandrasekaran | last post by:
Hai folks, I have a question to get exact answer from you people. My question is How Static class is differ from instance class and If you use static class in ASP.NET, ll it affect speed or...
5
by: evaristobo | last post by:
i'm a bit confused here, a pointer is something aiming to an object, but a static class is not an object, nevertheless i would like to have the possibility of doing something like handling an...
49
by: Ben Voigt [C++ MVP] | last post by:
I'm trying to construct a compelling example of the need for a language feature, with full support for generics, to introduce all static members and nested classes of another type into the current...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.