File: emptythrow.cc

package info (click to toggle)
c%2B%2B-annotations 8.2.0-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 11,804 kB
  • ctags: 2,845
  • sloc: cpp: 15,418; makefile: 2,473; ansic: 165; perl: 90; sh: 29
file content (71 lines) | stat: -rw-r--r-- 999 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <iostream.h>

class Object
{
    public:
        Object(char const *name);
        ~Object();
        void fun();
        void hello();
    private:
        char const
            *name;
};
/*
Object::Object(char const *n)
{
    name = n;
    cout << "Object constructor of " << name << "\n";
}

Object::~Object()
{
    cout << "Object destructor of " << name << "\n";
}

void Object::fun()
{
    cout << "Object fun() of " << name << "\n";
    throw new Object("'new object'");
}

void Object::hello()
{
    cout << "Hello by " << name << "\n";
}

*/
void emptythrow(Object *o)

{
            cout << "Caught exception\n";
            o->hello();
    throw;
}

/*
int main()
{
    Object
        out("'main object'");

    try
    {
        try
        {
            out.fun();
        }
        catch (Object *o)
        {
            emptythrow(o);
        }
    }
    catch (Object *o)
    {
        cout << "Caught exception again\n";
        o->hello();
        delete o;
    }
}

*/