Professional Documents
Culture Documents
Lec1 PDF
Lec1 PDF
Lecture 1
Dr Piotr Cybula <piotr.cybula@wmii.uni.lodz.pl>
Literature
Bruce Eckel: Thinking in C++. Second edition. Vol. 1.
(http://mindview.net/Books/TICPP/ThinkingInCPP2e.html)
Stanley Lippman, Josée Lajoie, Barbara Moo: C++ Primer. Forth edition.
http://cppreference.com
http://www.cplusplus.com
void set(Obj &o, int _a, int _b) //global function(& reference)
{
o.a = _a;
o.b = _b;
}
Obj x; //variable
set(x, 1, 2); //function call
File main.cpp:
#include ”obj.h”
int main()
{
Obj x; //the object (an instance of the class)
x.set(1, 2); //messege to the object
}
{
Obj x, *p = new Obj; //constructor calls
delete p; //the explicit destructor call (object *p)
} //the implicit destructor call (object x)