mirror of
https://github.com/szymon-jozef/ZUT-notatki.git
synced 2026-10-28 11:10:38 +01:00
kod
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
#include <iostream>
|
||||
|
||||
class Prostokat {
|
||||
private:
|
||||
int a;
|
||||
int b;
|
||||
|
||||
public:
|
||||
Prostokat() {} // dodany pusty konstruktor, by kod się skompilował
|
||||
Prostokat(int x, int y) : a(x), b(y) {}
|
||||
};
|
||||
Prostokat p1;
|
||||
|
||||
Prostokat p1; // w aktualnej formie się nie skompiluje, ponieważ nie istnieje
|
||||
// konstruktor bezargumentowy
|
||||
Prostokat p2(2, 3);
|
||||
Prostokat p3{4, 5};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user