constructor

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • maths_fan

    constructor

    If I have a constructor, can I use return without a value (as void) in it?

    class A
    {
    public:
    A() { return; }
    };

    ???
  • Leor Zolman

    #2
    Re: constructor

    On 27 Feb 2004 08:03:43 -0800, maths_fan@mail. ru (maths_fan) wrote:
    [color=blue]
    >If I have a constructor, can I use return without a value (as void) in it?
    >
    >class A
    >{
    >public:
    > A() { return; }
    >};
    >
    >???[/color]

    Sure. Don't think of it "as returning void", though; just think of it as
    terminating execution of the function.


    Leor Zolman
    BD Software
    leor@bdsoft.com
    www.bdsoft.com -- On-Site Training in C/C++, Java, Perl & Unix
    C++ users: Download BD Software's free STL Error Message
    Decryptor at www.bdsoft.com/tools/stlfilt.html

    Comment

    Working...