| References | Casting | Arrays | Import | instanceof | Package | Synchronization | Throwable | finally | Dangerous | Stack | String |
In Java, the classes are organized in packages. In ACDK, namespaces work in a similar way.
In Java, hierarchical packages are declared with package.
In ACDK, the native namespace mechanism is used.
// Java
import java.lang.*; // is not necessary in Java
import java.util.*;
Object getVector() { return new Vector(); }
// C++ / acdk
#include <acdk.h> // includes also basic packages: acdk::Lang, acdk::IO, acdk::Util
using namespace acdk::lang; // this is needed in acdk
using namespace acdk::util;
RObject getVector() { return new Vector(); }
|
As an alternative,you can use the verbose mode:
// Java
java.lang.Object getVector() { return new java.util.Vector(); }
// C++ / acdk
#include <acdk.h> // still needed
acdk::lang::RObject getVector() { return new acdk::util::Vector(); }
|
// Java:
package com.artefaktur.test;
class MyClass
{
// ...
}
// C++ / acdk:
namespace com {
namespace artefaktur {
namespace test {
class MyClass
{
// ...
};
} // test
} // artefaktur
} // com
|
|