Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class User {
- //one-to-one
- private Profile profile = new Profile(this);
- }
- public class Profile {
- private User user;
- public Profile(User user) {
- user.setProfile(this);
- this.user = user;
- }
- }
- class User(
- var profile: Profile = Profile(this) //error, since `this` is not in that context
- )
- class Profile (
- var user: User?
- ) {
- constructor(user: User): this(user)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement