ACDK Guide-CDK Type

xiaoxiao2021-03-06  41

ACDK Guide-CDK Type

Translation: Xue Changyu

In ACDK, you can use all possible types that can be used for C languages. However, if you want your code, you can be supported by garbage collection, object serialization, debugging, scripting, etc., then you should Use the type supported by the ACDK.

This chapter content:

Basic built-in type

Inherited type

Simple class

interface

Interface class

Namespaces

Basic build type

As Java, the following types are mapped to ACDK:

ACDK

Java

Comment

Bool

Boolean

Must be supported by the C compiler

charr

charr

!

8/7 bits characters

Uchar

charr

!

16 bits wide character

Byte

Byte

Map to (unsigned char)

Short

Short

int

int

Jlong

Long

The compiler must support. Image (long long) or int64

Float

Float

Double

Double

!

The type labeled is not supported by 'unsigned long or' const '(const "). None support pointer (int []).

Please see: Basic types.

Inherited type

ACDK complies with Java's rules about the development of classes:

1. All specific classes (no interface) must be inherited directly or indirectly in ACDK :: Lang :: Object

2, from the ACDK :: Lang :: Object Multiple inheritance is not supported.

3, the interface is pure empty.

4, a class can have multiple interfaces.

Simple class

As Java, all classes must be directly or indirectly inherited in ACDK :: Lang :: Object.

#include

ACDK_DECL_CLASS (ACLASS);

Class ACLASS

: Public ACDK :: Lang :: Object

{

}

// or

#include

ACDK_DECL_CLASS (Aspecialmap);

Class aspecialmap

: Public ACDK :: Util :: Hashmap

{

}

Please see: Object Types.

interface

The use of the interface is fully imitated Java:

#include

ACDK_DECL_INTERFACE (ainterface);

Class ainterface

{

PUBLIC:

Virtual void DOIT (RString arg) = 0;

}

Please see: Interface types.

Interface class

In the known class ACLASS and class ainterface, it seems like this:

Class bclass

: Public ACLASS,

Implements ainterface

{

PUBLIC:

BCLASS ()

: ACLASS ()

{

}

Virtual Void Doit (Rstring Arg)

{

// Do this

}

}

Namespaces

ACDK groups class into the package using C namespace.

#include

Using Namespace ACDK :: lang;

Using Namespace ACDK :: IO;

Class myWriter

: EXTENDS ACDK :: IO :: AbstractWrit,

Implements ACDK :: IO :: Serializable

{

// ...

}

Alternative Using Namespace you can use

USING_CLASS (:: ACDK :: Namespace ::, classname);

This may be inevitable in some compilers because they can't accurately describe

For example. MS VC .

#include

Using_class (:: acdk :: lang ::, string); using_class (:: ACDK:: IO ::, File);

Class myWriter

: EXTENDS ACDK :: IO :: AbstractWrit,

Implements ACDK :: IO :: Serializable

{

// ...

}

Please see: Namespace Type

This is an article I am free to translate, introducing the distributed framework acceptk. This is a foreign country, but there is no project in China. I hope everyone can like it because it is very casual, so there is no school translation of the content in the text, so it is inevitable that many shortages, please forgive

Translation: Xue Changyu 2004-12

转载请注明原文地址:https://www.9cbs.com/read-74245.html

New Post(0)