[{"createTime":1735734952000,"id":1,"img":"hwy_ms_500_252.jpeg","link":"https://activity.huaweicloud.com/cps.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=V1g3MDY4NTY=&utm_medium=cps&utm_campaign=201905","name":"华为云秒杀","status":9,"txt":"华为云38元秒杀","type":1,"updateTime":1735747411000,"userId":3},{"createTime":1736173885000,"id":2,"img":"txy_480_300.png","link":"https://cloud.tencent.com/act/cps/redirect?redirect=1077&cps_key=edb15096bfff75effaaa8c8bb66138bd&from=console","name":"腾讯云秒杀","status":9,"txt":"腾讯云限量秒杀","type":1,"updateTime":1736173885000,"userId":3},{"createTime":1736177492000,"id":3,"img":"aly_251_140.png","link":"https://www.aliyun.com/minisite/goods?userCode=pwp8kmv3","memo":"","name":"阿里云","status":9,"txt":"阿里云2折起","type":1,"updateTime":1736177492000,"userId":3},{"createTime":1735660800000,"id":4,"img":"vultr_560_300.png","link":"https://www.vultr.com/?ref=9603742-8H","name":"Vultr","status":9,"txt":"Vultr送$100","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":5,"img":"jdy_663_320.jpg","link":"https://3.cn/2ay1-e5t","name":"京东云","status":9,"txt":"京东云特惠专区","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":6,"img":"new_ads.png","link":"https://www.iodraw.com/ads","name":"发布广告","status":9,"txt":"发布广告","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":7,"img":"yun_910_50.png","link":"https://activity.huaweicloud.com/discount_area_v5/index.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=aXhpYW95YW5nOA===&utm_medium=cps&utm_campaign=201905","name":"底部","status":9,"txt":"高性能云服务器2折起","type":2,"updateTime":1735660800000,"userId":3}]
学过面向对象编程的程序员都是自我感觉不缺对象的,甚至觉得是一件很简单的事情,不信你看:
new girlfriend();
偷偷告诉你,玩这个梗的基本上都是真正的单身狗了!
<>面向对象初探
啥是面向对象嘞?我们常说面向对象编程是啥意思嘞?难道是天天对着自己的对象敲代码嘛?
这就扯远了,所谓的面向对象编程也就是OOP,它其实是一种程序设计的规范或者说是方法吧,也就是它会指导你如何进行程序的设计代码编写,是一种思想,编程思想,其实谈到思想这个层次就觉得高大上了不少,一般所谓的思想都是比较抽象的了。
面向对象说白了就是一种程序设计的规范,一般说的面向对象编程思想就是指的你得指导面向对象的程序该怎么区设计。
面向对象是一种编程思想,你有这个思想觉悟了嘛?
<>面向对象思想具体是什么
那所谓的面向对象编程思想是什么呢?一般面向对象思想指的就是你可以以现实世界中客观存在的事物也就是对象去设计程序,啥意思嘞?比如说大家都吃过水果吧,那么都知道水果一词就是个总的概括,就是一个抽象,只说水果你也不知道具体指的是什么,因为苹果,香蕉和橘子等等都是水果。
上述说的水果这些就是现实世界中客观存在的,那么在代码层面我们如何去表达这些呢?通过面向对象编程的思想,我们是可以把水果在代码层面给表示出来的,那怎么表示呢?
在面向对象的程序设计中,水果就是一个类别,就是一个类,然后像苹果啊,香蕉和橘子这些就是一个个具体的对象,好比水果是一个大的类别,其下有苹果,香蕉和橘子这些子类,也就是有一个类,就可以产生多个对象,然