Skip to main content

Type-safe Callbacks with Abstract Partners

  • Conference paper
OOIS’96
  • 67 Accesses

Abstract

In C++, a caller must know the type of the object whose methods it is calling. The objects called are typically implemented previously, e.g., in object libraries, and therefore their types are known. However, in some cases, a library object or any other previously implemented object needs to call back a user whose type is not known. We should therefore not make restrictive assumptions about the types of the objects that are called back. This is not a trivial problem in C++.

This paper presents a simple framework for implementation of object libraries. It illustrates a type-safe solution, a design pattern if you will, for an object which will be used by another object of any unknown type to call its user back. The solution is called an abstract partner, which is an abstract class that declares requirements for the user object. The compiler checks that these requirements are met, which makes the solution safe.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 84.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 109.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. J.Rumbaugh, M.Blaha, W.Premerlani, F.Eddy, W.Lorensen. Objectoriented Modeling and Design. Prentice-Hall, 1991.

    Google Scholar 

  2. J-M. Aalto and A. Jaaksi. Object-Oriented Development of Interactive Systems with OMT++. In R. Ege, M. Singh, B. Meyer, editors, TOOLS 14, Technology of Object-Oriented Languages & Systems, 205–218. Prentice Hall, 1994.

    Google Scholar 

  3. A. Jaaksi. Implementing Interactive Applications in C++, in Software Practice & Experience. Volume 25, No. 3. 271–289. John Wiley & Sons. March 1995.

    Article  Google Scholar 

  4. M.A.Ellis and B.Stroustrup. The Annotated C++ Reference Manual. Addison-Wesley Publishing Company, 1990.

    Google Scholar 

  5. V.Punkka. Intelligent Reusable User Interface Components, in The X Resource, Issue 13. 201–215. O’Reilly & Assoc. Inc. 1995.

    Google Scholar 

  6. J.Gettys and R.W.Scheifler. Xlib - C Language X Interface, MIT X Consortium Standard. Massachusetts Institute of Technology and Digital Corporation, 1991.

    Google Scholar 

  7. D.A.Young. Object-Oriented Programming with C++ and OSF/Motif. Prentice Hall, 1992.

    Google Scholar 

  8. A.Benson and G.Aitken. OI Programmer’s Guide. Prentice Hall, 1992.

    Google Scholar 

  9. R. Hickey. Callbacks in C++ Using Template Functors, in C++ Report, Vol. 7/No 2. 42–50. SIGS. February 1995.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 1997 Springer-Verlag London Limited

About this paper

Cite this paper

Jaaksi, A. (1997). Type-safe Callbacks with Abstract Partners. In: Patel, D., Sun, Y., Patel, S. (eds) OOIS’96. Springer, London. https://doi.org/10.1007/978-1-4471-0973-0_7

Download citation

  • DOI: https://doi.org/10.1007/978-1-4471-0973-0_7

  • Publisher Name: Springer, London

  • Print ISBN: 978-3-540-76132-7

  • Online ISBN: 978-1-4471-0973-0

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics