Click here to Skip to main content
15,885,771 members
Articles / Programming Languages / Java

Multi-Language Programming : Entity Object Inheritance And Function Overloading_3

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
17 Oct 2011CPOL2 min read 16.3K   1  
Multi-Language Programming : Entity Object Inheritance and Function Overloading

For multi-language programming based on common object environment, object is defined by different languages. Therefore, traditional object-oriented programming method is no longer suitable for this case. Developers cannot create an instance of a class defined in other language. For example, if a class is defined in Java, a C++ instance of it cannot be created.

Interface objects managed in common object environment are entity objects rather than abstract definition of specific languages. They exist in memory of application. Object-oriented concept is very meaningful. It can simplify software development and maintenance. Is there a way to introduce the concept of object-oriented to these entity objects? How to handle entity objects inheritance and function overloading?

Based on the support of the environment, developers can create instances of an entity object (interface object). Example is as follows:

From the above figure, we can see that entity objects can also act as class objects. They may have instances of other languages based on the support of common object environment. The instances can also define new attributes, new functions, or overloading functions defined in its class objects. Environment provides functions for application to access attributes or call functions of instances.

Attributes of objects may be defined by class object of other languages. The environment should provide functions for each language supported to access these attributes and perform parameter conversion. For examples, if class object of Java defines an attribute Para1, its C/C++ instance will inherit the attribute Para1. Both languages can access Para1, which is shown below:

Calling object functions is similar to accessing their attributes, common object environment supports to direct the call to correct entity object. For example, if a function “Add” is defined for Java class object, calling the function of a C/C++ instance of it should be redirected to Java language, which is shown below:

Function of class object may be overloading. In this case, calling of base function should be redirected to the overloading function. Common object environment will assist in the completion of the calling.

Traditional object-oriented method is supported by the compiler and language syntax. For entity objects in common object environment, because objects may be created and their functions may be defined by different languages, the language syntax and compiler can no longer support. To solve this problem, entity class objects are introduced and the environment runtime supports their inheritance and functions calling and overloading.

Further calling methods of objects that belong to different languages will be discussed later.

This article was originally posted at http://blog.yahoo.com/srplab/articles/65479

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
China China
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --