Using inheritance for computing with physical quantities: An interdisciplinary project

Seth Bergmann

Research output: Contribution to journalArticlepeer-review

Abstract

In this paper we have outlined an interdisciplinary software development project for students of computer science and physics. Students design and implement a collection of classes representing physical quantities, such as distance, time, and mass. Inheritance is used to implement various units for a particular dimension as subclasses. The student learns that, because a foot is a distance and a meter is a distance, inheritance is the appropriate mechanism here. The student also learns that certain computations should be disallowed since they are not meaningful. For example, the product of two distances should produce a syntax error (unless there is a class Area). Students design classes for more complex physical quantities such as speed, acceleration, force, momentum and energy. If implementing the classes in C++ the student also gets experience with operator overloading.

Original languageEnglish (US)
Pages (from-to)45-47
Number of pages3
JournalSIGCSE Bulletin (Association for Computing Machinery, Special Interest Group on Computer Science Education)
Volume30
Issue number1
DOIs
StatePublished - 1998

All Science Journal Classification (ASJC) codes

  • Software
  • Food Science
  • Hardware and Architecture

Fingerprint

Dive into the research topics of 'Using inheritance for computing with physical quantities: An interdisciplinary project'. Together they form a unique fingerprint.

Cite this