Teorija CPP: cestnoprometni predpisi: C, E, D – kat.: (za interno uporabo). Front Cover. Bojan Krajnc. B. Krajnc, – 89 pages. Index of /~slmurko/Teorija in vaje/ROM/Interaktivni raèunalniški teèaji/computing/ cpp. [ICO], Name · Last modified · Size · Description. [DIR], Parent Directory, -. Parent Directory, -. [TXT], BARCHART.C, Feb , K. [TXT], , Feb , K. [ ], , Feb , K.
|Published (Last):||2 June 2017|
|PDF File Size:||9.34 Mb|
|ePub File Size:||4.43 Mb|
|Price:||Free* [*Free Regsitration Required]|
In object-orientation, structure is organized by the data. With introducing parameters as well as procedures of procedures subprocedures programs can now be written more structured and error free.
For example a queue can be structured like a singly linked list. If you want to use a list within a procedure, say, foo you use the following code frame:. This has lead to the idea to extract these sequencesname them and offering a technique to call and return from these procedures.
Singly linked lists just provides access methods to append a new element to their end and to delete the element at the front. This handle is used in every provided procedure to uniquely identify the list in question.
For example, this ensures that the list is correctly deleted, returning resources to the program. We use a simple example to illustrate the particular properties and to point out their main ideas and problems.
This is necessary since you wish to use your list in several different environments, hence, the type of the data elements to be stored in the list is not known beforehand. For example insertion might be done such that an order over the elements is achieved or not.
As you should all know, this programming techniques provide tremendous disadvantages once the program gets sufficiently large. Traversing can be done using the following loop:. Our interface definition might then look similar to that below:. A code frame for this would look like this:. Beginning with the next chapters additional features of object-orientation are introduced which makes object-oriented programming to a new programming technique.
Note the difference to the previous version where you just hide functions or procedures, respectively. Roughly speaking, we can distinguish the following learning curve of someone who learns program:. We will now present an example which we use to present some design concepts. Programs use data structures to store data. Object-oriented programming solves some of the problems just mentioned.
This allows each module to manage an internal state which is modified by calls to procedures of this module. The main program directly operates on global data. You therefore create a new interface description which now includes a definition for a list handle.
The compiler should be able to check for type consistency. However, the example implies some problems which we will outline now. Objects of the program interact by sending messages to each other.
C++ Tutorial – Chapter 6
Fortunately, it is not. The list example implies operations to traverse through the list. Every other procedure now contains the special parameter this which just identifies the list in question. You choose the data representations which best fit your requirements.
Cpp teorija download
The overall function of the list is always the same, whether we teroija apples, numbers, cars or even lists. The main program coordinates calls to procedures and hands over appropriate data as parameters.
For that reason, modular programming allows grouping of procedures into modules. Therefore we would like to be able to define a list similar to the definition of an integer. It is automatically created and destroyed. In contrast to the other techniques, we now have a web of interacting objectseach house-keeping its own state Fig.
The calls to provided procedures remain the same.
Index of /~murkos/Teorija in vaje/LAV/Software_/KRMILJA/TC/CLASSLIB/SOURCE
With procedural programming you are able to combine returning sequences of statements into one single place. Each module can have its own data. Interface definitions just describe what is available and not how it is made available. Consequently, there is no longer the need to explicitly call a creation or termination procedure.
Your interface definition file of your new list module looks like this:. To enable usage of general procedures or groups of procedures also in other programs, they cppp be separately available. With modular programming teprija of a common functionality are grouped together into separate modules. Therefore it would be nice to declare a new list with something like:.
Within this chapter we will teoirja a very simple pseudo code which you should understand immediately.
Structure of a singly teorika list. Thus, the flow of data can be illustrated as a hierarchical graph, a treeas shown in Fig.
Instead of calling a procedure which we must provide with the correct list handle, we would directly send a message to the list object in question. Each of these data structures can be characterized by their structure and their access methods. Now a program can be viewed as a sequence of procedure calls. Consequently, your programs get structured by the data rather than operations.
The teirija is, that now the compiler takes care of calling initialization and termination procedures as appropriate.