Skip to content

Commit b8192e6

Browse files
committedDec 25, 2022
-- removed assignments
1 parent ea53e6f commit b8192e6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+464
-11487
lines changed
 

‎.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.DS_Store
22
/personal-notes
33
/personal
4-
/assignments
4+
/Assignments
55
*.out
66
/.vscode
77
midPractice3.cpp

‎Testing/autoTypes.cpp

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#include <iostream>
2+
using namespace std;
3+
4+
// i have two questions regarding the Auto type
5+
// one is that can functions just return autos, and this can become like javascript?
6+
7+
// lets check
8+
struct actor
9+
{
10+
int id;
11+
string name;
12+
string email;
13+
14+
actor(int id, string name, string email) : id(id), name(name), email(email){};
15+
};
16+
17+
struct User : actor
18+
{
19+
// nothing safe
20+
User(int id, string name, string email) : actor(id, name, email){};
21+
};
22+
23+
struct Admin : actor
24+
{
25+
int safeNumber;
26+
Admin(int id, string name, string email, int safeNumber) : actor(id, name, email), safeNumber(safeNumber){};
27+
};
28+
29+
// auto getActor(int safety = 0)
30+
// {
31+
// if(safety == 0)
32+
// {
33+
// return User();
34+
// }
35+
// else
36+
// {
37+
// return Admin();
38+
// }
39+
// }
40+
// this is not allowed, but meh.
41+
42+
actor* getActorData(int safety = 0)
43+
{
44+
if (safety == 0)
45+
{
46+
return new User(1, "user", "admin@gmail.com");
47+
}
48+
else
49+
{
50+
return new Admin(100, "admin", "admin@admin.com",3);
51+
}
52+
}
53+
54+
int main()
55+
{
56+
cout << getActorData() << endl;
57+
return 0;
58+
}

0 commit comments

Comments
 (0)
Please sign in to comment.