The difference between C, C ++, C # is

The difference between C and C ++

1. C language is a process-oriented, and C ++ is object-oriented. 
2, C language standard library, they loose, but the same functionality as a function in a header file; and C ++ for most functions are integrated very closely, especially the C language does not have C ++ the API is a combination of organic Window system most of the API, is a collective. But you can also call the API alone. 
3, especially in C ++ graphics, graphic language, and it's very different. C language graphics processing function is substantially not used in the C ++. C standard does not include a graphics processing. 
4, C and C ++ structure: the structure of the body C is not allowed to have a function, and the internal structure of the C ++ allows member functions (allowing constructor, destructor, and this pointer), and to allow this function is a virtual function; C structure of access to the internal member variables can only be public, but C ++ allows public, private, protected three kinds; C structure is not inherited, the structure is to allow C ++ inherits from another class or structure of;

4, C language programs can be written in many ways, but C ++ can write more and better, write DLL, write control, the write system. 
5, the organization of files on the C language program is loose, almost all to deal with the program; and C ++ based project organization to files, each file classification clear. 
6, IDE is very intelligent in C ++, and VB, as some features may be stronger than VB. 
7, C ++ you want to automatically generate the program structure so that you can save a lot of time. There are many tools available such as time added to MFC in the class, adding a variable time, and so on. 
8, C ++ is also a lot of additional tools, the system can be analyzed, you can view the API; you can view the controls. 
9, a powerful debugging, and diverse methods. 

 

C # language and C ++ difference: 

1.C # compared to C ++, it is most important feature is that C # is a fully object-oriented language, C ++ is both process-oriented and object-oriented language , while C # is based on the IL intermediate language and .NET Framework CLR in portability, maintainability and robustness than C ++ has greatly improved 

  ([1] C ++ inheritance C language, It can be procedural programming C language design, and may be abstract data types characterized by object-based programming can also be carried out inheritance and polymorphism characterized Object-oriented programming.

    [2] The main point is that object-oriented, with on the system design and implementation ideas, using the idea of ​​object-oriented, is determined from the system requirements of the class, and then press the object class instance, the communication between objects is realized function of the system.

    [3] Process-oriented, i.e., realization of the system is divided over a number of different functions (function) according to the process or processes designed to implement, is to do, after what, mainly by the function is called, because the process-oriented no object, these function does not belong to any object, no encapsulation, inheritance and other flexible use, once the system is huge, its design and the complexity of implementation and control with object-oriented than an order of magnitude. )

2. C # does not support multiple inheritance, which is a significant difference with C ++ place.

3. In the standard security code in C # does not support pointers types of operations , however, you are able to type object pointer in Microsoft operating so-called "non-secure Code". 

4. C #, all objects can only be created by keyword "new new" , "Object class name _ name" C ++ way becomes a statement in C # reference. Oh, things are objects, even common data types have become a target, JAVA is very strong.

5. Inside C #, the array elements are stored in the managed heap, compared to the uncertainty in the memory location of C ++ applications a continuous space much safer.

6, C ++, followed by the switch parameter must be int type, while C # does allow string type, this improvement really feel convenient than ever before!

7.C # fail situation will prohibit all switch..case statement, unless the statement is a space after the case, otherwise the statement before a case even if there is no break will stop the execution of the case statement later.

8. On the exception handling, C ++ allowed to throw any type, but in C # to a predetermined throw type derived from System.Exception object.

9.C ++ macros in C # abandoned lot, but not recommended, therefore rare.

10.C ++ templates In C #, no, but in C # we find a more sharp weapons to complete the task template: delegate.

11.C ++ global variables that concept no, C # and JAVA Similarly, we should put everything inside the class, also recommends using namespace contains them.

12.C # can be assigned directly to the property in the definition of class, while C ++ compiler error but it will do so.

13.C # There is a concept of a static constructor, the constructor is executed only once, it is possible to ensure that some of the static member is initialized only once.

14.C # automatic garbage collection mechanism to prevent memory leaks, the C ++ programmer freed from the burdensome memory management.

15. stronger type conversion protection mechanisms, such as the float turn into uint, direct conversion 0.35 becomes 0.34, because this can not be expressed in binary numbers, use System.Conver in the method, it is safe to convert the type of security come.

16. The commission new things and events, boxing and unboxing, Web Services ...... not a lot of C ++, I do feel that large-scale projects to facilitate the management, but also easy to expand, but start small projects, because it is compiled into IL code, the .NET Framework SDK support needed for the operation, efficiency is a problem, is not conducive to doing those operations that require high speed and memory consumption of the project. 

17.C # design goal is to develop fast and stable and scalable applications, of course, can do some of the underlying operating through Interop and Pinvoke, but for some very close and the underlying system-related programs (for example, say the driver), it is recommended in C ++ to write 
18.C ++ allowed to call another constructor (called the delegate constructor calls) in a constructor, but allows C #. Delegate constructor call syntax is very natural and easy to understand, in fact, C ++ does not provide this feature is not grammatical considerations, but out of consideration of resource management (such a thing for C ++ is there are many, many ). 
C ++ constructor for allocating resources, the destructor for the release of resources, constructor and destructor calls must match, otherwise break the basic rules of C ++. If allowed to delegate constructor calls, then obviously you break this rule - the constructor is performed twice, and the destructor is executed only once. Of course, for some categories, such as in front of the Point that this is not a problem, but from the perspective of language mechanisms of this property may belong characteristics "dangerous". Note: In the latest draft of the proposed standard C ++, Herb, who had a proposal for permission to delegate constructor call, of course, largely for the convenience of C ++ / CLI binding.

Original link: https: //blog.csdn.net/u012154840/article/details/78261001

Guess you like

Origin www.cnblogs.com/yuanch2019/p/11572675.html