博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
OOP design table chair bench
阅读量:7246 次
发布时间:2019-06-29

本文共 896 字,大约阅读时间需要 2 分钟。

abstract class material{    int weight;}class wood extends material{}class plastic extends material{}class metal extends material{}interface furniture {    material getMaterial();    void setMaterial(material m);}class table implements furniture{    material mat;    public material getMaterial(){        return mat;    }    public void setMaterial(material m){        mat =m;    }}class bench implements furniture{    material mat;    public material getMaterial(){        return mat;    }    public void setMaterial(material m){        mat =m;    }}class chair implements furniture{    material mat;    public material getMaterial(){        return mat;    }    public void setMaterial(material m){        mat =m;    }}

There are 3 products table,chair and bench. Product can be of wood ,metal and plastic . Design a class structures for this. 

转载于:https://www.cnblogs.com/leetcode/p/3271809.html

你可能感兴趣的文章
MongoDB 哈希分片为什么数据大小不均匀?
查看>>
研究人员发现了一个影响约60万台服务器的零日漏洞
查看>>
特斯拉的太阳能屋顶订单已经排到2018年
查看>>
为什么数据分析进行的预测不够成功
查看>>
Silverlight+WCF 新手实例 象棋 主界面-棋谱-获取列表(三十八)
查看>>
新开发银行首个光伏贷款项目落地上海
查看>>
阿里云欧洲、中东、日本和澳洲四大区数据中心相继启用
查看>>
印度太阳能大跃进 2017年计划实现装机100GW
查看>>
MEEM数据线可以在充电时备份手机数据
查看>>
ARM与台积电签订长期战略合作协议
查看>>
连续四年走低 PC市场被压缩的根源是什么?
查看>>
大数据来了,未来还需要会计吗?
查看>>
智利扩展光纤网络 拟扩张至少2万公里
查看>>
日本经济产业省将制定法规以确保中小规模光伏设备安全
查看>>
光伏能源虚拟货币:互联网+时代的先驱者
查看>>
这个僵尸网络自2014年起已经感染了近百万台设备
查看>>
凯萨医疗机构的CIO分享数字化转型经验
查看>>
激光投影企业对会议市场发起魅力攻势
查看>>
负载压力测试中监理的工作重点
查看>>
《拥抱变化——社交网络时代的企业转型之道》一信誉和风险管理
查看>>