Modules are the building blocks of D. It is based on a simple
concept. Every source file is a module. Accordingly, the single files
that we have been writing our programs in have all been individual
modules. By default, the name of a module is the same as its filename
without the .d extension.
পৃষ্ঠাসমূহ
Labels
Search Your Article
CS
Pageviews
Monday, January 30, 2017
D - Templates
Templates are the foundation of generic programming, which involves
writing code in a way that is independent of any particular type.
A template is a blueprint or formula for creating a generic class or a function.
A template is a blueprint or formula for creating a generic class or a function.
D - Immutable
We often use variables that are mutable but there can be many
occasions mutability is not required. Immutable variables can be used in
such cases. A few examples are given below where immutable variable can
be used.
D - File I/O
Files are represented by the File struct of the std.stdio module.
A file represents a sequence of bytes, does not matter if it is a text file or binary file. D programming language provides access on high level functions as well as low level (OS level) calls to handle file on your storage devices.
A file represents a sequence of bytes, does not matter if it is a text file or binary file. D programming language provides access on high level functions as well as low level (OS level) calls to handle file on your storage devices.
D - Concurrency
Concurrency is making a program run on more than one thread at a
time. An example of a concurrent program would be a web server
responding more than one client at the same time. Concurrency is easy
with message passing but very difficult to write if they are based on
data sharing.
D - Exception Handling
An exception is a problem that arises during the execution of a
program. A D exception is a response to an exceptional circumstance that
arises while a program is running, such as an attempt to divide by
zero.
Exceptions provide a way to transfer control from one part of a program to another. D exception handling is built upon three keywords: try, catch, and throw.
Exceptions provide a way to transfer control from one part of a program to another. D exception handling is built upon three keywords: try, catch, and throw.
D - Contract Programming
Contract programming in D programming is focused on providing a
simple and understandable means of error handling.Contract programming
in D are implemented by three types of code blocks:
- body block
- in block
- out block
D - Conditional Compilation
Conditional Compilation:
Conditional compilation is the process of selecting which code to compile and which code to not compile similar to the #if / #else / #endif in C and C++. Any statement that is not compiled in still must be syntactically correct. Conditional compilation involves condition checks that are evaluable at compile time.D - Classes & Objects
Classes are the central feature of D programming that supports
object-oriented programming and are often called user-defined types.
A class is used to specify the form of an object and it combines data representation and methods for manipulating that data into one neat package. The data and functions within a class are called members of the class.
A class is used to specify the form of an object and it combines data representation and methods for manipulating that data into one neat package. The data and functions within a class are called members of the class.
D - Inheritance
One of the most important concepts in object-oriented programming is
that of inheritance. Inheritance allows us to define a class in terms of
another class, which makes it easier to create and maintain an
application. This also provides an opportunity to reuse the code
functionality and fast implementation time.
D - Overloading
D allows you to specify more than one definition for a function name or an operator in the same scope, which is called function overloading and operator overloading respectively.
An overloaded declaration is a declaration that had been declared with the same name as a previously declared declaration in the same scope, except that both declarations have different arguments and obviously different definition (implementation).
An overloaded declaration is a declaration that had been declared with the same name as a previously declared declaration in the same scope, except that both declarations have different arguments and obviously different definition (implementation).
D - Encapsulation
All D programs are composed of the following two fundamental elements:
- Program statements (code): This is the part of a program that performs actions and they are called functions.
- Program data: The data is the information of the program which affected by the program functions.
Subscribe to:
Posts (Atom)