Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

7.35: A class cannot redefine a name used earlier outside the class as a type definition. #31

Open
xjay73 opened this issue Jun 21, 2021 · 0 comments

Comments

@xjay73
Copy link

xjay73 commented Jun 21, 2021

Line 9 is an error, redefining a name that had been used as a type earlier outside the class scope -- note that some compilers will not flag this as an error.

In lines 10, 11, and 16, then, Type will be std::string.
Line 18, then, has a type-mismatch error, since parm is a std::string (no conversion from std::string to int.)
Line 19, then, returns the wrong type.

To correct the errors, use a different name than Type for the in-class type definition of double, and adjust the name in lines 10, 11, and 16. Adjusting all three will fix the errors in lines 18 and 19 without further changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant