You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Practical Lab Assignment - Const member function, friend function, composition, friend functions and `this` pointer
2
+
3
+
**Note: In class diagram + for public, - for private.**
4
+
5
+
6
+
### Program 1
7
+
Define a class FullName and Player with the following specifications:
8
+
9
+
```
10
+
FullName
11
+
---
12
+
- FirstName: string
13
+
- MiddleName: string
14
+
- LastName: string
15
+
---
16
+
<<constructor>> + FullName()
17
+
<<destructor>> +~ FullName()
18
+
+ setFirstName(string)
19
+
+ getFirstName(): string
20
+
+ setMiddleName(string)
21
+
+ getMiddleName(): string
22
+
+ setLastName(string)
23
+
+ getLastName(): string
24
+
```
25
+
```
26
+
Player
27
+
---
28
+
-Player_ID: string
29
+
-Player_Name: FullName
30
+
-Matches_Played: int
31
+
-Goals_Scored: int
32
+
---
33
+
<<constructor>> + Player()
34
+
<<destructor>> +~ Player()
35
+
+ setPlayer_ID(string)
36
+
+ getPlayer_ID(): string
37
+
+ setMatches_Played(int)
38
+
+ getMatches_Played(): int
39
+
+ setGoals_Scored(int)
40
+
+ getGoals_Scored(): int
41
+
+ setPlayer_Name(FullName)
42
+
+ getPlayer_Name()
43
+
<<friend>> + Increase_GoalsScored(Player, int)
44
+
```
45
+
46
+
`Increase_GoalsScored(int)` is friend function for Player: This function will increase Goal_scored by some int every time when called.
47
+
48
+
Write C++ create object pointer(through new) to Class Player and menu driven program to add player details (allocate memory for object and get player details), display player details, increase player goal scored delete player from memory.
0 commit comments