Skip to content
Snippets Groups Projects
Commit 789a4537 authored by Vojtěch Novotný's avatar Vojtěch Novotný
Browse files

Update

parent 4b8b3c87
No related branches found
No related tags found
1 merge request!2DU
......@@ -6,6 +6,21 @@ class TridaA
// metody(funkce)
public:
int hodnota;
TridaA(int x)
{
hodnota = x;
std::cout << "Konstruktor TridaA2\n";
}
TridaA()
{
hodnota = 10;
std::cout << "Konstruktor TridaA1\n";
}
~TridaA()
{
std::cout << "Destruktor TridaA\n";
}
};
struct TridaB
......@@ -14,10 +29,15 @@ struct TridaB
int main()
{
TridaA a;
a.hodnota = 10;
TridaA a, b(5);
TridaA *c = new TridaA(10);
std::cout << "a.hodnota = " << a.hodnota << std::endl;
std::cout << "b.hodnota = " << b.hodnota << std::endl;
std::cout << c->hodnota << std::endl;
delete c;
return 0;
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment