Need help on this code
Need help on this code
class a { int b(int); } int a()::int b(int c)const { } Can any one tell me what does "const" here stands for. Regards chapz\n
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) constBut 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
10 Jan 07, 10:59AM
hi,
I was asked this code and it was the same ,
if i give cost at the end so that mean sit is constructor is it so.
Regardschapz
Login