Lista simple y doble enlazada POO
Publicado por Ritcher (1 intervención) el 09/10/2021 01:54:33
Necesito ayuda tengo este codigo con el cual tengo 3 clases, la primera de mi estructura y otras 2 siendo la lista simple y otra la doble, mi idea es unir las clases con un protected para cada constructor y asi heredar la lista a cada clase pero no tengo idea de como mandar a llamar o como crear un objeto en el main o hacerlo de manera optima en cada clase lo que se me pide, aqui el codigo:
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#include <iostream>
using namespace std;
class StructBase
{
struct Address
{
char name[50];
char street[100];
char city[50];
char state[20];
int pin;
Address *siguiente;
};
protected:
show();
Insert();
seek();
Delete();
};
class List: StructBase
{
protected:
insertFirst();
insertLast();
insertMiddle();
};
class ListDouble : List
{
ShowReverse();
Insert();
insertFirst();
insertLast();
insertMiddle();
};
int main()
{
int opc;
do
{
cout << "\tINTRODUCE AN OPTION:\n";
cout << "\n\t1.-Show\n\t2.-Insert\n\t3.-Seek\n\t4.-Delete\n\t5.-Exit\n\t";
cout << "\n\tOPTION: ";
cin >> opc;
switch(opc)
{
case 1:
cout << "\t";
system("pause");
system("cls");
cout << "\tShow the list\n\n";
// show();
break;
case 2:
cout << "\t";
system("pause");
system("cls");
cout << "\tInsert a node in the list\n\n";
// Insert();
system("pause");
break;
case 3:
cout << "\t";
system("pause");
system("cls");
cout << "\tSeek a node in the list\n\n";
// seek();
system("pause");
break;
case 4:
cout << "\t";
system("pause");
system("cls");
cout << "\tEliminate node\n\n";
// Delete();
system("pause");
break;
case 5:
cout << "\n\tGoodbye\n\t";
system("pause");
break;
default:
cout << "\n\tChoose a correct value\n\t";
system("pause");
break;
}
system("cls");
}
while(opc!=5);
return 0;
}
Valora esta pregunta


0