About This eBook by Bart De Smet

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

O'Reilly logo

Abstract Classes

Recall our definition of the Shape class. One remark we made when defining its two virtual properties was the fact we had to provide default implementations that didn’t really have much meaning:

class Shape{    public virtual double Area    {        get { return 0.0; }    }    public virtual double Circumference    {        get { return 0.0; }    }}

Although 0.0 might seem like a good default value, wouldn’t it be much better not to have to specify a value at all? What does it even mean to create an instance of the Shape object? Isn’t a shape something very abstract that needs to be concretized to help someone draw a mental picture? Although Square and Circle are very concrete, the concept of a ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required