CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 17

Threaded View

  1. #3
    Join Date
    Nov 2010
    Posts
    105

    Re: Why can't member variable be initialized?

    Quote Originally Posted by Lindley View Post
    .... Instead, you have to do
    Code:
    struct A
    {
        int i;
        A(): i(0) {}
    };
    Thank you! I suppose this is equivalent to setting the values in the body of the constructor function? Like
    A(){i=0;}
    ?
    Last edited by acppdummy; November 16th, 2010 at 11:13 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured