What will happen if I define a class like below code with Swift, the complier doesn't give any errors:
class Test {
var test = Test()
}
What will happen if I define a class like below code with Swift, the complier doesn't give any errors:
class Test {
var test = Test()
}
Nothing strange happens.
It is perfectly legal for a class to hold a reference to an instance of the same class (i.e.: liked lists, trees, etc.)