Linux -Blue forest free software | Return to home page | Site Map | Search WWW | Contact Us |
Your current position : Homepage > Free Software > Technological exchanges >Application Programming


    

Blue Forest http://www.lslnet.com at 10:18 on June 6, 2006


C + + has a similar java "Object" type?

Existing Java code to be translated into C + +.
There is a common type of java "Object", but C + + seems to be useless?

The following example :
Java code :
[code]public 14.00 MyHashtable extends Hashtable --

Object lock1;

Public MyHashtable () (

Super ();

Lock1 = new Object ();

    }
[/code]

Whether using C + + template :
[code]template "Class Object>
14.00 : public map<int MyHashtable, int>
{
Object *lock1;
Public :
MyHashtable () (
Lock1 = new Object;
        }
[/code]

But java codes are everywhere containing "Object",
Are we going to find each containing "Object" category, ahead of its January 1 with the template statement?

I novice C + +, neighborhoods Ch'ing. .

Java is a single inheritance. And the C + + multiple inheritance is.
GC is Java, C + + programmer is required for their survival object management.
Java support operational period types of information, not based on C + + standard operation, suggested types of information programming period.
The continued support of Java objects, C + + will have no choice but to realize himself.

Hashtable single inherited from the Object, the C + + Standard Library provides hash_map, hash_set other things.

Thank you for your excellent suggestion -
According to you now, I understand :
Template Object is a contingency measure.
C + + is a complete way of thinking should be re-designed package. .
However, the template is feasible?
Because "C + + will have no choice but to achieve yourself."
Template method of "self-help achieve" a behavior

Another :
Hash_map with a map which recommends you?

Object inside a lot of functions in Java. He types of information to support the operational period, continued to object, it is the root of all types of Java classes, Java C + + lacks the elements, it would not be a complete library of common standards. Only some revenue to the Treasury for the specific application. In the end you do not know what to do, so you can make suggestions.

If you just use C + +, then, do not consider the use of templates, or to achieve a single reservoir succession of bars, or consider using some of the existing reservoir.

Hash_map with a map which recommends you?

The reason for hash operations, in order to improve the operating performance of key matches, it is up to you to identify the performance requirements.

Thank you much :)



 Privacy Policy  Copyright © 1999-2000 LSLNET.COM. All rights reserved. Blue Forest website owners. E-mail : Webmaster@lslnet.com