inner classes allowed consrtuctors?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • gara.matt@gmail.com

    #1

    inner classes allowed consrtuctors?

    Hi,

    Are nested/inner class allowed to have constructors?

    When I try to compile something like

    class A{

    public:

    class B{
    public:
    B(int a)
    { b =a;}

    int b;
    }

    };


    I get the error:

    error: expected ',' or '...' before numeric constant on line "B(int
    a)"

  • Sumit Rajan

    #2
    Re: inner classes allowed consrtuctors?

    gara.matt@gmail .com wrote:
    Hi,
    >
    Are nested/inner class allowed to have constructors?
    >
    When I try to compile something like
    >
    class A{
    >
    public:
    >
    class B{
    public:
    B(int a)
    { b =a;}
    >
    int b;
    }
    Insert a ";" here.
    >
    };
    >
    >
    I get the error:
    >
    error: expected ',' or '...' before numeric constant on line "B(int
    a)"
    >
    Hope that helps.

    Regards,
    Sumit.

    --
    Sumit Rajan <sumit.rajan@gm ail.com>

    Comment

    Working...