package com.sf.day06;

public class Test02 {

    public static void main(String[] args) {
        //丈夫对象
        Husband h = new Husband();

        h.name = "张三";
        h.age = 22;
        h.desc = "高达帅气";

        //类属性 默认 null
        //创建  妻子对象
        Wife wife = new Wife();
        wife.name = "小红";
        wife.age = 25;
        wife.desc = "温柔大方";

        wife.husband = h;

        //在丈夫属性中给妻子 赋值
        h.wife = wife;

        System.out.println("丈夫信息："+h.name+" "+h.age+" "+h.desc);
        System.out.println("妻子信息："+h.wife.name+""+h.wife.age+" "+h.wife.desc);

        //通过妻子访问丈夫
        System.out.println(wife.husband.name);

    }
}
