Advertisement

An Introduction to Classes

  • Joe Pitt-Francis
  • Jonathan WhiteleyEmail author
Chapter
  • 9.8k Downloads
Part of the Undergraduate Topics in Computer Science book series (UTICS)

Abstract

One of the key features of the C++ programming language is that it is object-oriented. Up until now we have largely ignored this feature, making only passing reference to it in earlier chapters. In this chapter we discuss in more detail three properties of object-orientation: modularity; abstraction; and encapsulation. This allows us to motivate the need for developing classes: entities where the data, and the operations on the data, are stored in one place. Access privileges to the members of a class are introduced: these prevent a user of a class from inadvertently corrupting the data or functionality of the class. We conclude the chapter by developing a class of complex numbers. This allows us to introduce operator overloading: a feature that permits us to define what we mean by addition, subtraction, multiplication and division of complex numbers, allowing much more natural looking C++ code to be written when performing these operations on complex numbers.

Keywords

Complex Number Linear Solver Object File Class Member Access Privilege 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

References

Mathematical Methods and Linear Algebra

  1. 4.
    Trefethen, L.N., Bau, D.: Numerical Linear Algebra. Society for Industrial and Applied Mathematics, Philadelphia (1997) Google Scholar

Copyright information

© Springer-Verlag London Limited 2012

Authors and Affiliations

  1. 1.Department of Computer ScienceUniversity of OxfordOxfordUK

Personalised recommendations