Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What are Signatures anyway?

0
Posted

What are Signatures anyway?

0

————————— Roughly, signatures are type abstractions or interfaces of classes. They are related to ML’s signatures, categories in Axiom, definition modules in Modula-2, interface modules in Modula-3, and types in POOL-I. The main language constructs added are signatures and signature pointers. For example, the signature declaration signature S { int foo (void); int bar (int); }; defines a new abstract type `S’ with member functions `int foo (void)’ and `int bar (int).’ Signature types cannot be instantiated since they don’t provide any implementation. Only signature pointers and signature references can be defined. For example, C obj; S * p = &obj; defines a signature pointer `p’ and initializes it to point to an object of class type `C,’ where `C’ is required to contain the public member functions `int foo (void)’ and `int bar (int).’ The member function call int i = p->foo (); executes then `obj.foo ().’ Class `C’ is called an implementation of the abstract type `S.’

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123