1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Abstract class confusion

Discussion in 'C#' started by ddanbe, Aug 28, 2010.

  1. ddanbe

    ddanbe New Member

    Aug 28, 2010
    Likes Received:
    Trophy Points:
    As all textbooks on C# will tell you, you cannot instantiate an abstract class.
    I believe the keyword abstract was intended for that purpose.
    So can anyone tell me why I can do something like this:
    abstract class TwoDShape
    // some code here

    class test
    static void Main()
    TwoDShape shape = new TwoDShape(); // this gives an error
    TwoDShape[] shapes = new TwoDShape[4]; // this is OK

Share This Page