Comparison of C + +, Java, OC object Models (Dry goods)

Source: Internet
Author: User

The recent sudden thought of the OC object model is relatively clear, then C + +, Java How to implement it?

Reference documents:

http://www.cnblogs.com/skynet/p/3343726.html Wu Qin (Tyler) C + + object model

http://blog.csdn.net/jamesmf/article/details/7710149


1. First, easy to understand, generic implementation?

C + + generics, using compile-time processing, add the corresponding function name + parameter name, run-time direct call;

Java generics, pseudo generics, compile-time type checking, and so on, when the JVM actually loads class, it takes type erase (the generated class file is the original type of data)

OC None

2. Single Inheritance

1.c++ Inheritance (more complex), first assumed to be simple single inheritance, no overwrite, no multiple inheritance, no virtual inheritance.

Basic model: Virtual function table pointer + non-static data internal deposit element (continuous)

No overwrite: base class is not affected the virtual function table of directly expanding subclasses (late Father class, later subclass virtual function)

2.java inheritance to be continued ....

3. OC inheritance, OC The actual model is a struct, including class object and Meta class (seemingly somewhat similar to Java), each object contains super and Isa pointers, pointing to the parent class address and the object pointer, respectively


Cond....




Comparison of C + +, Java, OC object Models (Dry goods)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.