I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
Index » Programming » C/C++ »

john\′s Photo
10 Jan 07, 9:13AM
Are you sure you've got that code right? I think your backets may by miss-positioned. For a start a class should usually finish with a ';', unless you're declaring a type thereafter.

As for const. I think what you have is int a() is the functioning with of class a. Therefore by placing const at the end of the line, you saying that the member function a (also the constructor since they have the same name), won't change any other elements within class a. Which is rather odd for a constructor.

However

::int(int c)

would be illegal if this was a member function, I would expect to see something more like this:

int a(int c)::b(c) const

But even that would be illegal, since constructors can't return data like this - there set up to return a pointer to the newly created class!!

So now I'm well confused. Where did you find this code?

John
Currently you need to be logged in to leave a message.