CS 211: Introduction to Computer Programming II - PowerPoint PPT Presentation

1 / 3
About This Presentation
Title:

CS 211: Introduction to Computer Programming II

Description:

Let's us add new datatypes. But don't look like builtins. Method ... Use cautiously. Obscures behavior. Can actually implement opposite behavior for an operator ... – PowerPoint PPT presentation

Number of Views:33
Avg rating:3.0/5.0
Slides: 4
Provided by: briand8
Category:

less

Transcript and Presenter's Notes

Title: CS 211: Introduction to Computer Programming II


1
CS 211Introduction to Computer Programming II
  • Instructor Brian M. Dennis
  • Teaching Assistants
  • Tom Lechner, Bin Lin, Rachel Goldsborough
  • http//www.cs.northwestern.edu/bmd/cs211/

2
Todays Topics
  • More operator overloading
  • Developing a class
  • Reading 8.8 8.13

3
Operator Overloading
  • Syntactic extension
  • Class mechanism
  • Let's us add new datatypes
  • But dont look like builtins
  • Method syntax isn't always natural

4
Operator Overloading
  • What can be overloaded
  • Most operators
  • Can't do
  • . ., ?
  • Can't add any new ones
  • Can't change associativity
  • Can't change precedence
  • Can't change arity
  • Nothing done automatically for you
  • Issues
  • arity binary vs unary
  • operator side
  • Use cautiously
  • Obscures behavior
  • Can actually implement opposite behavior for an
    operator

5
Thats a Wrap
Write a Comment
User Comments (0)
About PowerShow.com