OOPS的现实世界的例子 [英] Real world example of OOPS

查看:185
本文介绍了OOPS的现实世界的例子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我非常好奇地想知道像多态性,继承,抽象和虚拟类的面向对象特性的实际执行情况。

在网上,我可以看到相关的汽车,球等例子,但我没有找到相关的一个真实的世界之情况例如像什么

我有一个购物网站,其中有4个角色


  

      
  1. 管理谁将会观看/修改
      网站


  2.   
  3. 员工:谁的员工
      该网站


  4.   
  5. 互联网用户:谁来买
      产品


  6.   
  7. 整体出售经销商:参与方将使用
      在同一网站上不同的接口
      购买散装产品。

  8.   

每个角色可以修改产品根据需要。

例如:尽管订购T-shirst用户希望把他的文字,颜色...等

任何建议,在那里我可以像使用虚拟类,抽象类,继承概念呢?

只是想知道如何能优化性能,可靠性和可扩展性。


解决方案

有关OOP注释:比如像面向对象形式的图案或结构code的方式,从你的方式问过这个问题,看来你是学习和想利用这些模式,这很好,我会推荐这样的思想(与被意识到code是如何构建的)的。认识到这些模式和结构,配有两个和使用为不同的类型的框架来开发特定acheive目标的经验。我不认为有您的所有问题的答案,因为书已经写了这一点,但继续读取和发展code和这些东西会成为自然的。

I am very much curious to know the practical implementation of object oriented features like Polymorphism, inheritance, abstract and virtual classes.

On internet I can see examples related to car, ball etc. but I didn't find anything related to a real world scenerio like for example

I have a shopping website, which has 4 roles

  1. Admin: who will watch/modify the site

  2. Employee: Who are the employees of that site

  3. Internet User: Who will buy the product

  4. Whole sale dealer: Who will use the different interface on the same site to buy products in bulk.

Each and every role can modify the product as per the need.

Example: While ordering t-shirst user wants to put his text, color... etc

Any suggestions as to, where I can use concepts like virtual class, abstract class, inheritance in it?

Just curious to know how can it optimize the performance, reliability and scalability.

解决方案

A comment about OOP: Things like OOP form patterns or ways of structuring code, from the way you've asked the question, it seems you are learning and want to utilise these patterns, this good and I would recommend this kind of thinking (and being conscious of how code is constructed). Recognising these patterns and structures comes with experience in both using and developing for differnt types of frameworks to acheive specific goals. I dont think there is an answer for all your question, as books have been written about this, but continue reading and developing code and these things will become natural.

这篇关于OOPS的现实世界的例子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆