home *** CD-ROM | disk | FTP | other *** search
- #include <stream.hpp>
-
- class C1 {
- int x;
- public:
- void foo (long x);
- void foo (int x);
- };
-
- class C2 : public C1 {
- public:
- void foo (long x);
- };
-
- void C1::foo (int x)
- {
- cout << "C1::foo(int)\n";
- }
-
- void C1::foo (long x)
- {
- cout << "C1::foo(long)\n";
- }
-
- void C2::foo (long x)
- {
- cout << "C2::foo()\n";
- }
-
- main()
- {
- C2 cl;
- C1 cl1;
- int i;
- long l;
- char c;
-
- cl.foo (i);
- cl.foo (l);
- cl.foo (c);
-
- cl1.foo (i);
- cl1.foo (l);
- //cl1.foo (c); //Zortech will not compile this line.
-
- /* try adding another definition to the base class. This will test to see
- if there is an "overloaded mode" that the translator is in to activate
- searching. */
- /* the first set still converts everything to long and calls C2::foo(). The
- second set, added as a control, calls foo(int) for int and char types. */
- /* Zortech gives the same results, except it will not compile the last call.
- It cannot decide whether to convert the char into an int or a long. */
-
- /* conclusions: The current class is searched for a solution. I presume that
- if no match was found after trying user-supplied conversions it would
- consider base class functions inherited. Tests 9 & 10 do not give
- any evidence toward this, so I use this as a hypotises for the next test.
- It does not tell me the precidence of member functions with an implicit
- recievier and global functions. */
- }
-