public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* "self" constructor
@ 2000-03-22 17:22 Min Xu
  2000-03-22 17:53 ` Alexandre Oliva
  2000-03-23  0:59 ` Martin v. Loewis
  0 siblings, 2 replies; 7+ messages in thread
From: Min Xu @ 2000-03-22 17:22 UTC (permalink / raw)
  To: gcc

Hi all,
  I used to be a java programmer before I recently graduated into c++. I

have a question about calling a constructor of a class from another
constructor of this class. I already searched the archives of this
mailing
list, however, I can't find answers about it.
  My question in detail is that why following code is rejected by gcc?
(my version is 2.95.2)

// test class for "self" constructor
class test {
private:
    int i;
    int j;
public:
    test(int ii):i(ii) {};
    test(int ii, int jj):test(ii), j(jj) {};
}

  I know this code is too much java-like, but my point is why it is
disallowed?
I guest "super()" isn't in c++ is because c++ has multi-inheritance. But
why not
"this()"?

  Thank you for your attention for reading my question.
Min

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: "self" constructor
@ 2000-03-22 19:07 Mike Stump
  2000-03-23  6:40 ` Min Xu
  0 siblings, 1 reply; 7+ messages in thread
From: Mike Stump @ 2000-03-22 19:07 UTC (permalink / raw)
  To: gcc, mxu

> Date: Wed, 22 Mar 2000 19:22:18 -0600
> From: Min Xu <mxu@cae.wisc.edu>

> I have a question about calling a constructor of a class from
> another constructor of this class. I already searched the archives
> of this mailing list, however, I can't find answers about it.

That's because this list isn't for discussing how to program in the
C++ programming language.  I believe you want the comp.lang.c++ forum.
Give that a try, I think you'll find an answer over there, thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2000-03-23  9:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-22 17:22 "self" constructor Min Xu
2000-03-22 17:53 ` Alexandre Oliva
2000-03-23  0:59 ` Martin v. Loewis
2000-03-23  6:35   ` Min Xu
2000-03-23  9:21     ` Martin v. Loewis
2000-03-22 19:07 Mike Stump
2000-03-23  6:40 ` Min Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).