Jive reference manual
|
Provides support for creating Java-like interfaces. More...
#include <jem/base/Interface.h>
Inherited by jem::Clonable, jem::gl::ColoredMarker, jem::gl::Compound, jem::gl::Pivotable, jem::gl::RedrawRoot, jem::gl::Transformable, jem::io::DataInput, jem::io::DataOutput, jem::io::Serializable, jem::io::TextInput, jem::io::TextOutput, jem::io::WordCompleter, jem::mp::TaskFactory, jem::numeric::UserFunc::ArgList, jem::numeric::UserFunc::NameSpace, jem::util::Enumerable, jem::xutil::SnoopDictionary::Filter, jive::algebra::DiagMatrixExtension, jive::algebra::DirectMatrixExtension, jive::algebra::MPMatrixExtension, jive::algebra::MultiMatmulExtension, jive::algebra::SparseMatrixExtension, jive::fem::VirtualBoundary, jive::fem::VirtualElement, jive::fem::VirtualIBoundary, jive::geom::BezierExtension, jive::geom::Grad2Extension, jive::mp::ScatterCodec, jive::solver::LocalRestrictor, and jive::util::EventSource.
Protected Member Functions | |
virtual | ~Interface () |
Empty destructor. More... | |
The Interface
class mimicks the interface data type provided by the Java programming language. You define an interface by defining a class that:
Interface
class or one or more other interfaces;Here is an example:
An interface is implemented by defining a class that inherits the interface and the Object
class, and implements all methods defined by the interface. Inheriting the Object
class is not strictly necessary, but ensures that the class implementing the interface is compatible with many data structures and algorithms provided by Jem.
Here is an example of a class implementing the interface defined above:
There is nothing magic about the Interface
class; you are free to define an interface that does not inherit the Interface
class. However, by inheriting the Interface
class you clearly indicate that a class is to be used as an interface.
Collectable
class, it is good practice to declare the destructor of the interface as a protected member. This ensures that a collectable object implementing the interface can not be deleted prematurely by means of a delete expression.
|
protectedvirtual |
The destructor of the Interface
class does nothing. It is only declared to ensure the destructor of derived classes is virtual.