下一个面向对象的编程 [英] C for an Object-Oriented programmer

查看:132
本文介绍了下一个面向对象的编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

已经学会了Java和C ++中,我学会了面向对象的方法。我要走上一个相当宏大的计划,但我想这样做在C.我知道如何突破的问题分解成类,以及如何将其变成类层次结构。我知道如何抽象的功能集成到抽象类和接口。我甚至在一个有效的方式使用多态有所精通。

Having learned Java and C++, I've learned the OO-way. I want to embark on a fairly ambitious project but I want to do it in C. I know how to break problems down into classes and how to turn them into class hierarchies. I know how to abstract functionality into abstract classes and interfaces. I'm even somewhat proficient at using polymorphism in an effective way.

问题是,当我一个问题psented $ P $,我唯一的办法,我知道如何做到这一点是在面向对象的方式。我已经变得过于依赖面向对象的设计理念和方法。

The problem is that when I'm presented with a problem, I only way I know how to do it is in an Object-Oriented way. I've become too dependent on Object-Oriented design philosophies and methodologies.

我想学习如何在严格程序的方式思考。我该怎么做事情缺乏类,接口,多态,重载函数,构造一个世界等。

I want to learn how to think in a strictly procedural way. How do I do things in a world that lacks classes, interfaces, polymorphism, function overloading, constructors, etc.

仅使用非面向对象的结构■如何重新present复杂的概念?你如何解决缺乏函数重载的?什么是一些提示和技巧以过程方法在想什么?

How do you represent complex concepts using only non-object-oriented structs? How do you get around a lack of function overloading? What are some tip and tricks for thinking in a procedural way?

推荐答案

该程序的方法是,一方面,有你的数据结构,并且,另一方面,你的算法。然后你把你的数据结构并传递给你的算法。如果没有封装,它需要一个稍高量纪律要做到这一点,如果你增加了抽象层,使其更容易把事情做对,你正在做OO的C.有相当一部分

The procedural way is to, on one side, have your data structures, and, on the other, your algorithms. Then you take your data structures and pass them to your algorithms. Without encapsulation, it takes a somewhat higher amount of discipline to do this and if you increase the abstraction level to make it easier to do it right, you're doing a considerable part of OO in C.

这篇关于下一个面向对象的编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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