1#include <iostream>
2using namespace std;
3
4class Foo
5 {
6 public:
7 Foo ( )
8 {
9 cout << "constructor Foo\n";
10 }
11};
12
13class Bar
14 {
15 public:
16 Bar ( Foo )
17 {
18 cout << "constructor Bar\n";
19 }
20};
21
22int main()
23{
24 /* 1 */ Foo* foo1 = new Foo ();
25 /* 2 */ Foo* foo2 = new Foo;
26 /* 3 */ Foo foo3;
27 /* 4 */ Foo foo4 = Foo::Foo();
28
29 /* 5 */ Bar* bar1 = new Bar ( *new Foo() );
30 /* 6 */ Bar* bar2 = new Bar ( *new Foo );
31 /* 7 */ Bar* bar3 = new Bar ( Foo foo5 );
32 /* 8 */ Bar* bar3 = new Bar ( Foo::Foo() );
33
34 return 1;
35}
36
1class Rectangle {
2 int width, height;
3 public:
4 void set_values (int,int);
5 int area (void);
6} rect;