
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Monday 01 March 2004 03:46 am, Davi de Castro Reis wrote:
Jerry Feldman wrote:
Yes. In general the base class constructor is called implicitly, but you
I think Steven asked if the constructor of the _own_ object can be called inside another constructor.
Yes, that was my intention. The attempt I made to do so resulted in an error saying the constructor of the class called by the outer constructor was not an immediate base class of the calling class.
I don't think it is possible. You usually mimic it with defaults values, but I really prefer the Java approach (actually, it is probably the only thing I like in Java).
There are several things I like about Java over C++. Since I have far less C++ experience, I can't name as many good things I like about it over Java. I'm still unsure if operator overloading is a good or a bad thing. I would like to see a language called C3 (or something like that). That is C2++. It would be C++ unencumbered by backward compatibility requirements, and would have either a restricted mode, or simply provide a more orthogonal subset of C++. I really believe one of the strengths of Java is its limitation on the number of ways you can accomplish the same thing. Another thing C++ suffers from is the header file. A few days back, I came across a site providing what is ostensibly an automatic header file generator. The programmer simply writes the source code in the source file, and the header file is generated by running the source through the generator. If this is possible for all cases of C++ source files, it suggests to me the header file is indeed a superfluous burdon on the programmer. I think the intention was probably good when the header file was introduced. In the early C days it may have been far more useful than it is today. The idea of laying out your class in a declaration before defining it has advantages, conceptually. OTOH, I can name some negatives resulting from the use of header files: 1) the requirement that the header file and source code be kept in sync adds to the coder's work load, as well as to the opportunity for error. 2) the need to refer back to the header file while composing the source file is distracting, and breaks the coder's train of thought, especially for a person who has not yet internalized that behavior. 3) There are different places such things as default values for arguments can be set. Without standard styles being adapted, we have to look in at least two places to see what's really going on. If the human mind is capable of handling a finite amount of complexity. The more complexity the programming language imposes on our work, that much less capacity is left over for the implementation. To some extent, I believe one of the biggest problems with C++ is that it is typically presented as a variant of C with a complete C-style introduction to the language preceding the introduction of the OO aspects. I present Stroustrup's own selection of examples from TC++PL to support what I've said: http://www.research.att.com/~bs/3rd_code.html Note that his Hello World is not OO. Also note that he does not have a single header file in the entire list of examples.
Davi
STH -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQFAQVv7wX61+IL0QsMRAsZCAKCj0smBXh86MtckhzY+0/vQrZ1IEQCgoPH1 EsW4iRYtkIFsCVjMd9fy7II= =zkFi -----END PGP SIGNATURE-----