linkedin-skill-assessments-quizzes
linkedin-skill-assessments-quizzes copied to clipboard
Kotlin - question 45
The real reason behind the code snippet not compiling is that name
parameter for class Cat
should be defined as a property (contain val
/var
keyword) otherwise fun greet()
won't have access to it, thus giving unresolved reference error for this.name
.
None of the provided answers are correct for this question.
Hello @roozbehzarei , thank you for submitting an issue! 👍 We highly appreciate it if you work on it as well.
@roozbehzarei thanks for your comment and sorry for being later, I think we can add it as a comment directly under the question. Because I think it is better to keep original code snippet to make it searchable. But I got your point which is very valuable to keep under this question. Feel free create PR or let me know I can do it. Thanks
Created PR #4177 to add the necessary details.