
- •Pointers
- •Procedural programming
- •Object oriented programming
- •3) The basic paradigms of object-oriented programming: encapsulation, polymorphism and inheritance.
- •Identifier or function name
- •7) String functions in the programming language Java.
- •8.Loops and branching statements in the programming language Java
- •The break Statement
- •The return Statement
- •11) Creation and using one-dimensional and multi-dimensional arrays in the programming language Java.
- •13) Working with I / o system in the programming language Java
- •17) Classification of data types in the programming language Java.
- •18) Java Object Model.
- •1. Java Distributed Object Model
- •1.1 Basic Concepts of the Java Object Model
- •1.2 Basic Concepts of the Java Distributed Object Model
- •1.3 Objects
- •19) Generics in the programming language Java.
- •Example
- •Rules in function overloading
- •Pointer Variables (or Pointers)
- •Declaring Pointers
- •30) Dynamic memory allocation operations: new and delete.
- •Operators new and new[]
- •Operators delete and delete[]
Pointers
The index contains the memory address. When your program transfers the massif (for example, a symbolical line) in the function, C ++ are transferred by the address of the first element of the massif. As a result absolutely usually for function to use the index for a symbolical line. To declare the index for a symbolical line, function simply precedes a name a variable asterisk, as shown below:
void some_function (char * string);
The asterisk which precedes a variable name, specifies C ++ that the variable will store the memory address — the index. The following PTR_STR.CPP program uses the index for a symbolical line in the show_string function for a conclusion of contents of a line on one symbol for once:
#include <iostream.h>
void show_string (char * string)
{
while (*string! = '\0')
{
cout <<* string;
string ++;
}
}
void main (void)
{
show_string ("We learn to program in language C ++! ");
}
Pay attention to the cycle while in the show_slring function. while condition (*string! = '\0') checks, whether the current symbol specified by means of the index of string, a NULL symbol which defines the last symbol of a line is. If the symbol not NULL, a cycle removes the current symbol by means of cout. Then operator of string ++; increases siring index in such a way that it points to the following symbol of a line. When the index of string indicates a NULL symbol, function already removed a line and the cycle comes to the end.
2. Difference of procedural programming to object-oriented programming.
Procedural programming
In procedural programing our code is organised into small "procedures" that use and change our data. In ColdFusion, we write our procedures as either custom tags or functions. These functions typically take some input, do something, then produce some output. Ideally your functions would behave as "black boxes" where input data goes in and output data comes out.
The key idea here is that our functions have no intrinsic relationship with the data they operate on. As long as you provide the correct number and type of arguments, the function will do its work and faithfully return its output.
Sometimes our functions need to access data that is not provided as a parameter, i.e., we need access data that is outside the function. Data accessed in this way is considered "global" or "shared" data.
So in a procedural system our functions use data they are "given" (as parameters) but also directly access any shared data they need.
Object oriented programming
In object oriented programming, the data and related functions are bundled together into an "object". Ideally, the data inside an object can only be manipulated by calling the object's functions. This means that your data is locked away inside your objects and your functions provide the only means of doing something with that data. In a well designed object oriented system objects never access shared or global data, they are only permitted to use the data they have, or data they are given.