Menu
×
×
Correct!
Exercise:Specify that Person.name can only be accessed within the class, but that the method Person.getName() can be accessed anywhere:
class Person {
@(7) name: string;
public constructor(name: string) {
this.name = name;
}
@(6) getName(): string {
return this.name;
}
}
class Person {
private name: string;
public constructor(name: string) {
this.name = name;
}
public getName(): string {
return this.name;
}
}
Not CorrectClick here to try again. Correct!Next ❯ |
This will reset the score of ALL 30 exercises.
Are you sure you want to continue?