Topic: member functions


Author: Panenka <zmpanenka@hotmail.com>
Date: Mon, 2 Apr 2001 11:52:03 CST
Raw View
The Standard says;

    9.3 Member Functions
1   Functions declared in the definition of a class, excluding
    those declared with a friend specifier(11.4), are called
    member functions of that class.

If I understand correctly, this description does not exclude
constructors that are declared in the definition of the class.
So, are constructors considered as member functions from The
Standard's point of view ?

regards,

_____________________________________________________________________
This message has been checked for all known viruses by the
MessageLabs Virus Control Centre. For further information visit
http://www.messagelabs.com/stats.asp

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: Jack Klein <jackklein@spamcop.net>
Date: Mon, 2 Apr 2001 20:16:15 CST
Raw View
On Mon,  2 Apr 2001 11:52:03 CST, Panenka <zmpanenka@hotmail.com>
wrote in comp.std.c++:

> The Standard says;
>
>     9.3 Member Functions
> 1   Functions declared in the definition of a class, excluding
>     those declared with a friend specifier(11.4), are called
>     member functions of that class.
>
> If I understand correctly, this description does not exclude
> constructors that are declared in the definition of the class.
> So, are constructors considered as member functions from The
> Standard's point of view ?
>
> regards,

No, constructors are not functions.  They have no return type and they
can't be called.  Since they are not functions they cannot be member
functions.

--
Jack Klein
Home: http://JK-Technology.Com

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: "James Kuyper Jr." <kuyper@wizard.net>
Date: Mon, 2 Apr 2001 21:21:27 CST
Raw View
Jack Klein wrote:
...
> No, constructors are not functions.  They have no return type and they
> can't be called.  Since they are not functions they cannot be member
> functions.

Incorrect - constructors are functions, they just don't have function
names.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: "James Kuyper Jr." <kuyper@wizard.net>
Date: Mon, 2 Apr 2001 21:59:09 CST
Raw View
Panenka wrote:
>
> The Standard says;
>
>     9.3 Member Functions
> 1   Functions declared in the definition of a class, excluding
>     those declared with a friend specifier(11.4), are called
>     member functions of that class.
>
> If I understand correctly, this description does not exclude
> constructors that are declared in the definition of the class.
> So, are constructors considered as member functions from The
> Standard's point of view ?

Yes. Section 12, describing "Special member functions", includes section
12.1, which describes constructors.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: Panenka <zmpanenka@hotmail.com>
Date: Mon, 2 Apr 2001 22:56:20 CST
Raw View
Jack Klein wrote:
>
> On Mon,  2 Apr 2001 11:52:03 CST, Panenka <zmpanenka@hotmail.com>
> wrote in comp.std.c++:
>
> > The Standard says;
> >
> >     9.3 Member Functions
> > 1   Functions declared in the definition of a class, excluding
> >     those declared with a friend specifier(11.4), are called
> >     member functions of that class.
> >
> > If I understand correctly, this description does not exclude
> > constructors that are declared in the definition of the class.
> > So, are constructors considered as member functions from The
> > Standard's point of view ?
> >
> > regards,
>
> No, constructors are not functions.  They have no return type and they
> can't be called.  Since they are not functions they cannot be member
> functions.

So why does The Standard use sometimes the wording "constructor function"
or the like, say, "...but the resulting construct is a function call upon
a constructor function..."(1.9/13), "...evaluation of a new expression
invokes one or more allocation and constructor functions..."(1.9/17),
"...for constructor functions..."(3.3.6/5), "...if the function is a
constructor..."(footnote29), "Only in function declarations for
constructors..."(7/7), "...if the function is a constructor..."(8.5/14),
"...for a constructor function..."(9.3/5), "a class member function(9.3),
other than constructors..."(17.1.9)  and so on ? And also why the syntax
for a constructor definition is under the title of "Function definitions"
(8.4), if it is not a function?

regards,

_____________________________________________________________________
This message has been checked for all known viruses by the
MessageLabs Virus Control Centre. For further information visit
http://www.messagelabs.com/stats.asp

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]