Do different abstract classes and interfaces / class

1. Do different abstract classes and interfaces:

Similarities: Both are inherited and need to be achieved before meaningful, and both have an abstract type.

Different points: Abstract belong to the class, the interface is a new data type;

    Abstract class attributes may be variables and constants, and interface properties can only be constant;

    Can abstract methods and the conventional method in the abstract class; while only abstract interface method;

    The method of abstract class implemented by inheriting his class, and abstract methods interface to the class that implements the interface;

2. Interface and class similarities and differences:

    The same point: class interfaces and data types, attributes are constant, the method has an abstract method;

    Differences: class, there are also variables constant, and the need to implement the method, the interface only constant, and the method simply declare; can have abstract methods and general methods, interfaces, only abstract methods in the class,

Guess you like

Origin www.cnblogs.com/zhangweigang/p/11758683.html