By ADEEL ABBAS, Bhakkar. AdeelAbbasbk@gmail.com
Templates
Advantages:
Templates are easier to write than writing several versions of
your similar code for different types. You create only one generic
version of your class or function instead of manually creating
specializations.
Templates are type-safe. This is because the types that
templates act upon are known at compile time, so the compiler can
perform type checking before errors occur.
Templates can be easier to understand, since they can provide a
straightforward way of abstracting type information.
It helps in utilizing compiler optimizations to the extreme. Then
of course there is room for misuse of the templates. On one hand
they provide an excellent mechanism to create specific type-safe
classes from a generic definition with little overhead.
Disadvantages:
On the other hand, if misused
Templates can make code difficult to read and follow depending
upon coding style.
They can present seriously confusing syntactical problems esp.
when the code is large and spread over several header and source
files.
Then, there are times, when templates can "excellently" produce
nearly meaningless compiler errors thus requiring extra care to
enforce syntactical and other design constraints. A common mistake
is the angle bracket problem.
#includes:
The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system provided file, or in quotes if the file is user provided.
Allocation:
The process of giving memory space to an object. Also see dynamic storage, static storage, and deallocation
Argument:
When calling a function, refers to the actual values passed to the function.
Array:
An ordered and indexable sequence of values. C++ supports arrays of a single dimension (a vector) or of multiple dimensions.
Assignment:
The process of giving a value to a pre-existing object.
Bool:
C++ keyword used to declare a Boolean data type.
Break:
C++ keyword used to specify a statement that is used to break out of a for or while loop or out of a switch statement.
Call by reference:
Passing a pointer to an argument to a function. The function can then change the argument value. Also see call by value.
Call by value:
Passing a copy of an argument to a function. The function cannot then change the argument value. C and C++ use call by value argument passing. But also see pointer and reference, also see call by reference.
Case:
A C++ keyword used to denote an individual element of a switch statement.
Char:
A C++ keyword used to declare an object of character type. Often considered the same as a byte, though it is possible to have multi-byte characters.
Class:
A C++ keyword used to declare the fundamental building block of C++ programs. A class has a tag, members, access control mechanisms, and so on.
Class member:
A constituent member of a class, such as a data declaration, a function, or a nested class.
Compiler:
A software tool that converts a language such as C++ into a different form, typically assembly language.
Continue:
C++ keyword used with for and while statements to continue the iteration at the top of the loop.
Copy constructor:
A special type of constructor that is called when an object is copied.
Debugger:
A tool for stepping through the execution of a program, examining variables, setting breakpoints, and so on.
cout:
In C++ stream I/O, the standard output stream.
Data structure:
The term data structure refers to the way data is organized for use within a program. Correct organization of data can lead to simpler and more efficient algorithms. Common data structures are linked-lists, stacks, queues and trees.
Default argument:
An optional argument to a function. A value specified in the function declaration is used if the argument is not given.
Delete operator:
C++ keyword and operator used to delete dynamic storage.
Derived class:
A class that inherits members from a base class.
No comments:
Post a Comment
PLEASE COMMENT ABOUT YOUR VISIT AND MY SITE
Note: Only a member of this blog may post a comment.