Wrox Programmer Forums
|
C# 2008 aka C# 3.0 Discuss the Visual C# 2008 (aka C# 3.0) language
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2008 aka C# 3.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 24th, 2011, 08:54 AM
Authorized User
 
Join Date: Jun 2009
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Why static class is abstract??
__________________
Happy coding...

Arnab Roy Chowdhury.
 
Old May 24th, 2011, 01:00 PM
Authorized User
 
Join Date: Mar 2011
Posts: 17
Thanks: 3
Thanked 0 Times in 0 Posts
Default

What do you want to achieve by inheriting a static class ? What are your specs ?
As for why static classes are abstract ? You can ask try asking in the MSDN forums.
 
Old October 31st, 2011, 02:42 AM
Registered User
 
Join Date: Oct 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The main reason that you cannot inherit a static class is that they are abstract and sealed (this also prevents any instance of them from being created).
So this:
Static class Foo { }

Compiles to this IL:
.class private abstract auto ANSI sealed beforefieldinit Foo
extends [mscorlib] System. Object
{
}
 
Old October 31st, 2011, 03:28 AM
Authorized User
 
Join Date: Jun 2009
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Smile

Ok.. Thanks..
__________________
Happy coding...

Arnab Roy Chowdhury.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Static variables in Static Class JoinTTT BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 4 March 29th, 2009 05:08 PM
Using logging class as a static class punitw General .NET 0 August 14th, 2008 03:03 AM
static field with class instance prakash.suthar Java Basics 2 July 3rd, 2006 01:41 AM
static Class in ASP chafor ASP.NET 1.0 and 1.1 Basics 4 January 13th, 2006 10:58 AM
who destroy static variables(no instance of class) MikoMax J2EE 1 March 31st, 2004 08:01 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.