reference to abstract class

前端 未结 4 480
一向
一向 2020-12-05 08:53

What does it mean when there is a reference to an abstract class? I found it in code and I can\'t understant it.

I thought that an abstract class can\'t be instantia

4条回答
  •  执念已碎
    2020-12-05 09:31

    An abstract class is designed to be derived from. The Liskov substitution principle roughly states that anything that uses the abstract parts of types derived from an abstract base should work equally well using the base polymorphically. That means a reference or pointer to the base should be used.

提交回复
热议问题