English 中文(简体)
C. 语言节目是否面向目标?
原标题:Is the C programming language object-oriented?

我与一位同事讨论了C和C++问题,他声称C是面向目标的,但我声称这不是。 我知道,你可以做C类的面向目标的工作,但C++是一种真正的面向目标的语言。

你们的想法是什么?

此外,它引发了关于由谁来决定它意味着什么以目标为导向的讨论,并且很难说什么真正以目标为导向是官方手段。 你对此有何想法?

最佳回答

如果用“C物体导向吗?”字指“C是否设计了专门用于支持面向目标的方案拟订的设施?”,那么,C则显然不是反对的。

问题回答

您可以以一种或多或少的语文,以目标为导向的方式进行节目。 (我认为,超时多变——即虚拟方法——需要一种支持职能点的人的语言。)

以下是几个例子:

真正的方案人员可以用纽约语撰写面向目标代码。

但没有,C不是面向目标的语言。 它没有阶级、目标、多变、继承的概念。

回答 是:

  • 如果请将C作为目标语言?>,答案是“否”,因为它没有目标型构造、关键词、语义等。

  • 如果您打算在C?>上实现OOP,答案是肯定的,因为OOP不仅需要一种语言,而且是一种在接触某种语言之前的“思考”方法。 然而,在C实施OOP(或非本地设计为OOP)肯定是“强迫的”,很难管理任何其他OOP语言,因此,预计也会有一些限制。

C在“O-O”和“语言”的任何定义中不属于O-O语言。

非常容易地将C用作一个组成部分的执行语言,使其客户能够使用O-OPIC。 XWindows系统基本上是一个单一继承式的O-O系统,从APICA系统的角度来看待,但在观察其实施时,整个C层。

混淆可能是,C可用于实施诸如多变、资本等面向目标的概念,这些概念可能导致你的朋友相信C是面向目标。 问题是,要把这些特点视为面向目标的方案拟订语言,就必须将这些特征纳入语言。 不是。

除非您的朋友谈论目标C(C的办公室超级编组),否则C就不是一种联络处语言。 你们可以采用C(旧的冒犯C++汇编者所做的事情,将C++翻译成C)的联络处概念,但这种概念使C成为业务处的一种语言,因为它没有具体地为业务办公室的标准技术提供支持,如多变或资本。

是的,你可以在C处书写软件业务办公室风格,特别是自由(滥用)使用宏观产品,但我强烈建议使用一种更合适的语言。

  1. C is not object oriented in strict sense since it doesn t have a built-in syntax supported object oriented capability like class, inheritance and so on.

但是,如果你知道这种骗局,你就能够轻易地把目标导向的能力仅仅用结构、功能点和安放;自我点。 直接 英国广播公司是这种以目标为本的C图书馆。 坏事更容易发生,因为它不受yn子的管制,并汇编检查类型。 它以编码公约为基础。

e.g.

  IDirectFB/*a typedef of a struct*/ *dfb = NULL;
  IDirectFBSurface/*another typedef of a struct*/ *primary = NULL;
  DirectFBCreate (&dfb); /*factory method to create a struct (e.g. dfb) with 
                         pointers to function and data. This struct is 
                         like an object/instance of a class in a language with build-in 
                         syntax support for object oriented capability  */
  dfb->SetCooperativeLevel/*function pointer*/ 
          (dfb/*self pointer to the object dfb*/, 
           DFSCL_FULLSCREEN);
  dsc.flags = DSDESC_CAPS;
  dsc.caps  = DSCAPS_PRIMARY | DSCAPS_FLIPPING;
  dfb->CreateSurface/*function pointer, also a factory method 
                       to create another object/instance */
          ( dfb/*self pointer to the object dfb*/, 
            &dsc, 
            &primary/*another struct work as object of another class created*/ );
  primary->GetSize/*function pointer*/ 
              (primary/*self pointer to the object primary*/, 
               &screen_width, 
               &screen_height);

页: 1 C++以目标为导向,因为它支持以目标为导向的能力,如阶级和遗产。 但有观点认为,它不是一个完全或纯粹的物体导向语言,因为它的确允许C syntax(结构性方案制定)加入。 我还记得,C++缺乏少数目标导向的能力,但没有确切地记住每一个能力。

C is not object oriented language. C is a general-purpose, imperative language, supporting structured programming. Because C isn t object oriented therefore C++ came into existence in order to have OOPs feature and OOP is a programming language model organized around objects. A language in order to have OOPs feature needs to implement certain principles of OOPs.Few of them are Inheritance, Polymorphism, Abstraction , Encapsulation.

C是一种基于目标的语言,它不支持以目标为导向的语言的许多特征,例如继承、多变性等。

真正的方案人员可以用纽约语撰写面向目标代码。

页: 1 反对: Cobol that calls Cobol. 你们是否希望把这些方案者称为“Real”?

页: 1 反对:

www.un.org/Depts/DGACM/index_french.htm

C++does

C is not object oriented. C++ is not object oriented. Let me explain: Object Oriented is an extension to Simula s old fashion event driven subset. Real Object Oriented are functional and reflective because Object Oriented is really a group of paradigms (event driven, functional, reflective). Only four language are really object oriented and these are Lisp,Smalltalk,Ruby and Ocaml. Perl lags between because its not functional. Scala is not reflective so also lags behind. C++ is only event driven with some Simula like facilities but its completely structured programming language and its not declarative or even matchs real world. Object Oriented matchs real world with Functional (Maths), Event Driven (Conversations) and Reflectiveness (Evolution). C++ only has conversations. C++ is not declarative like maths or doesnt evolve like life. C++ only converses like people. C++ is like an idiot that doesnt know how maths work or how life evolves.

不是,你的朋友错了。





相关问题
Fastest method for running a binary search on a file in C?

For example, let s say I want to find a particular word or number in a file. The contents are in sorted order (obviously). Since I want to run a binary search on the file, it seems like a real waste ...

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

Tips for debugging a made-for-linux application on windows?

I m trying to find the source of a bug I have found in an open-source application. I have managed to get a build up and running on my Windows machine, but I m having trouble finding the spot in the ...

Trying to split by two delimiters and it doesn t work - C

I wrote below code to readin line by line from stdin ex. city=Boston;city=New York;city=Chicago and then split each line by ; delimiter and print each record. Then in yet another loop I try to ...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

Encoding, decoding an integer to a char array

Please note that this is not homework and i did search before starting this new thread. I got Store an int in a char array? I was looking for an answer but didn t get any satisfactory answer in the ...

热门标签