TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: RENE HERMAN
from: TIM HUTZLER
date: 1998-04-21 19:50:00
subject: Re: Default constructor

-=>Quoting Rene Herman to All <=-
RH>Hello All ...
RH>According to ANSI C++, will a constructor with nothing but default
RH>arguments do as a default constructor?
It *is* the default constructor.
RH>I'm learning C++, and my textbook (Mastering Borland C++ 5 by Tom
RH>Swan) declares a TTime class providing two constructors:
RH>When I however add a "-1" default argument for "m" in the second
RH>constructor and delete the first constructor, Borland 5 doesn't
RH>seem to have a problem recognizing it as a default constructor.
RH>That is, "TTime Time;" and "TTime Time[SIZE];" compile just fine,
RH>calling TTime(-1, -1, -1, - 1, -1) as their constructor.
Rene;
Every class MUST have a default constructor. But, if a default
constructor (no args) is not specified in your code, the compiler
will create one for you. That's why there was no error.
___ Blue Wave/QWK v2.12
--- Maximus/2 3.01
---------------
* Origin: Madman BBS * Chico, California * 530-893-8079 * (1:119/88)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.