-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
60 lines (49 loc) · 1.99 KB
/
main.cpp
File metadata and controls
60 lines (49 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: zelhajou <zelhajou@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/01/01 18:37:50 by zelhajou #+# #+# */
/* Updated: 2025/01/02 20:28:31 by zelhajou ### ########.fr */
/* */
/* ************************************************************************** */
#include "Base.hpp"
#include <iostream>
int main()
{
Base *base = generate();
std::cout << "Identifying using pointer: ";
identify(base);
std::cout << "Identifying using reference: ";
identify(*base);
delete base;
std::cout << "\nTesting explicit types:" << std::endl;
Base *a = new A();
std::cout << "Type A - Pointer identification: ";
identify(a);
std::cout << "Type A - Reference identification: ";
identify(*a);
delete a;
Base *b = new B();
std::cout << "Type B - Pointer identification: ";
identify(b);
std::cout << "Type B - Reference identification: ";
identify(*b);
delete b;
Base *c = new C();
std::cout << "Type C - Pointer identification: ";
identify(c);
std::cout << "Type C - Reference identification: ";
identify(*c);
delete c;
std::cout << "\nTesting invalid types:" << std::endl;
Base *invalid = new Base();
std::cout << "Invalid type - Pointer identification: ";
identify(invalid);
std::cout << "Invalid type - Reference identification: ";
identify(*invalid);
delete invalid;
return 0;
}