~ubuntu-branches/ubuntu/trusty/c++-annotations/trusty

« back to all changes in this revision

Viewing changes to yo/polymorphism/exception.yo

  • Committer: Package Import Robot
  • Author(s): Frank B. Brokken
  • Date: 2011-09-12 16:08:05 UTC
  • mfrom: (1.1.17 upstream)
  • Revision ID: package-import@ubuntu.com-20110912160805-r9dq68beojgzuien
Tags: 9.0.2-1
New upstream release (editorial changes)

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
thrown. Now that we've introduced i(polymorphism) we can further develop this
5
5
example.
6
6
 
7
 
It will probably not come as a surprise that our class tt(Exception) should be
 
7
It probably does not come as a surprise that our class tt(Exception) should be
8
8
a polymorphic base class from which special exception handling classes can be
9
9
derived. In section ref(EMPTYTHROW) a member tt(severity) was used offering
10
10
functionality that may be replaced by members of the tt(Exception) base class.
24
24
        verbinclude(examples/warning.h)
25
25
        verbinclude(examples/fatal.h)
26
26
 
27
 
When the example program is started without arguments it will throw a
28
 
tt(Fatal) exception, otherwise it will throw a tt(Warning) exception. Of
 
27
When the example program is started without arguments it throws a
 
28
tt(Fatal) exception, otherwise it throws a tt(Warning) exception. Of
29
29
course, additional exception types could also easily be defined. To make the
30
30
example compilable the tt(Exception) destructor is defined above tt(main). The
31
31
default destructor cannot be used, as it is a virtual destructor. In practice