import std.stdio;
union Data {
int i;
float f;
char str[13];
};
void main( ) {
Data data;
writeln( "size of : ", data.sizeof);
import std.stdio;
class Box {
public:
// Constructor definition
this(double l = 2.0, double b = 2.0, double h = 2.0) {
import std.stdio;
class Line {
public:
this() {
writeln("Object is being created");
}
~this() {
import std.stdio;
class Line {
public:
void setLength( double len ) {
length = len;
}
double getLength() {
import std.stdio;
class Line {
public:
void setLength( double len ) {
length = len;
}
double getLength() {
import std.stdio;
class Line {
public:
double length;
double getLength() {
return length ;
}
void setLength( double len ) {
import std.stdio;
class Box {
public:
double length;// Length of a box
double breadth;// Breadth of a box
import std.stdio;
class Box {
public:
double length;// Length of a box
double breadth;// Breadth of a box
import std.stdio;
enum Days {
sun,
mon,
tue,
wed,
thu,
fri,
sat
};
void myFunction(T)(T mytemplate) {
static if (is (T == class)) {
import std.stdio;
import std.string;
double getAge(double months,double years)
in {
assert(months >= 0);
import std.stdio;
import std.string;
bool isValid(string password)
in {
assert(password.length>=5);
import std.stdio;
import std.string;
string division(int a, int b) {
string result = "";
try {
import std.stdio;
import std.concurrency;
import core.thread;
import std.conv;
void workerFunc(Tid tid) {
import std.stdio;
import std.concurrency;
import core.thread;
import std.conv;
void workerFunc(Tid tid) {
import std.stdio;
import std.concurrency;
void printTid(string tag) {
writefln("%s: %s, address: %s", tag, thisTid, &thisTid);
import std.stdio;
void print(immutable int[] array) {
foreach (i, element; array) {
writefln("%s: %s", i, element);
import std.stdio;
import std.random;
void main() {
int min = 1;
int max = 10;
const number = uniform(min, max + 1);
import std.stdio;
import std.random;
void main() {
int min = 1;
int max = 10;
immutable number = uniform(min, max + 1);
import std.stdio;
enum Day{
Sunday = 1,
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday
}
void main() {
import std.stdio;
int main () {
/* local variable definition */
int a = 100;
/* check the boolean condition */
import std.stdio;
class Box {
protected:
double width;
}
class SmallBox:Box{ // SmallBox is the derived class.
import std.stdio;
class Box {
public:
double length;
// Member functions definitions
double getWidth() {
import std.stdio;
import std.string;
import std.datetime;
abstract class Person {
int birthYear, birthDay, birthMonth;
import std.stdio;
import std.string;
import std.datetime;
abstract class Person {
int birthYear, birthDay, birthMonth;
import std.stdio;
// Base class
interface Shape {
public:
void setWidth(int w);
void setHeight(int h);
static void myfunction1() {
import std.stdio;
// Base class
interface Shape {
public:
void setWidth(int w);
void setHeight(int h);
}
// Derived class
import std.stdio;
class Adder {
public:
// constructor
this(int i = 0) {
total = i;
}
// interface to outside world
import std.random;
import std.stdio;
import std.string;
struct Box {
int volume;
int opCmp(const ref Box box) const {
import std.stdio;
class Box {
public:
double getVolume() {
return length * breadth * height;
}
void setLength( double len ) {
import std.stdio;
class Box {
public:
double getVolume() {
return length * breadth * height;
}
void setLength( double len ) {