Class-Inheritancing Error

David T. Oxygen TKC847567 at outlook.com
Sun Jul 27 11:08:33 UTC 2025


I wrote a piece of code like this:

```d
class Person{
	string name;
	this(string name){this.name=name;}
}
class Someone:Person{
	alias super this;
}
void main(){
	Someone x=new Someone("Bob");
}
```
And then,I got a Error-Message:
```
ab.d(6): Error: variable name expected after type `super`, not 
`this`
     alias super this;
                 ^
ab.d(6):        `this` is a keyword, perhaps append `_` to make 
it an identifier

```
Who knows why I can't use `alias this` there? Please tell 
me,thanks very much. I'm waiting for you.


More information about the Digitalmars-d-learn mailing list