home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!utcsri!sys.toronto.edu!byu
- Newsgroups: comp.os.os2.programmer
- From: byu@sys.toronto.edu (Benjamin Yu)
- Subject: Re: emx/gcc very forgiving!!
- Message-ID: <1993Jan21.102941.16328@jarvis.csri.toronto.edu>
- Organization: University of Toronto
- References: <1993Jan19.140346.4351@jarvis.csri.toronto.edu> <1993Jan20.045839.25052@netcom.com> <1993Jan20.102705.23327@jarvis.csri.toronto.edu> <1jkjleINNfn9@gap.caltech.edu>
- Date: 21 Jan 93 15:29:42 GMT
- Lines: 24
-
- In article <1jkjleINNfn9@gap.caltech.edu> brooke@cco.caltech.edu (Brooke Paul Anderson) writes:
- >byu@sys.toronto.edu (Benjamin Yu) writes:
- >
- >
- >>Here goes:
- >>class elevator {
- >> int floor_selected;
- >> int floor_number;
- >>public:
- >> elevator() { floor_selected = 0; floor_number = 0;} ;
- >> elevator(int x = 10, int y = 10) { floor_selected = x; floor_number = y; };
- >>};
- >
- ...
- >
- >If it gives you a warning, I'd say that's good enough. Also, your
- >overloaded function doesn't look ambiguous at all to me. One takes two
- >ints as arguments; the other takes no arguments.
- >
-
- The first definition requires no argument. The second definition allows
- 0, 1, or 2 arguments. Thus it is ambiguous with the first definition.
-
- Ben
-