Language: C++

#include <stdio.h>
#include <iostream>
#include <string.h>
using namespace std;

//
class Node {
private:
	int key;
	Node *p_next = NULL;
	Node *p_prev = NULL;
public:
	Node(int k);
	void linkNext(Node *n);
	void linkPrev(Node *n);
	Node *getNext();
	Node *getPrev();
	bool hasKey(int k);
	void printKey();
};

Node::Node(int k)
{
	key = k;
}

void Node::linkNext(Node *p_n)
{
	p_next = p_n;
}

void Node::linkPrev(Node *p_n)
{
	p_prev = p_n;
}

Node *Node::getNext()
{
	return p_next;
}

Node *Node::getPrev()
{
	return p_prev;
}

bool Node::hasKey(int k)
{
	return key == k;
}

void Node::printKey()
{
	cout << key;
}

//
class LinkedList {
private:
	Node *p_dummy;
	void linkNode(Node *p_n1, Node *p_n2);
public:
	LinkedList();
	void linkNode(Node *p_n1, Node *p_n2);
	void insertNode(int x);
	void deleteNode(int x);
	void deleteFirst();
	void deleteLast();
	void print();
};

LinkedList::LinkedList()
{
	Node n(-1);
	n.linkNext(&n);
	n.linkPrev(&n);
	p_dummy = &n;
}

void LinkedList::linkNode(Node *p_n1, Node *p_n2)
{
	(*p_n1).linkNext(p_n2);
	(*p_n2).linkPrev(p_n1);
}

void LinkedList::insertNode(int x)
{
	Node n(x);
	linkNode(&n, (*p_dummy).getNext());
	linkNode(p_dummy, &n);
}

void LinkedList::deleteNode(int x)
{
	Node *p_n = (*p_dummy).getNext();
	while (!(*p_n).hasKey(x)) {
		if ((*p_n).hasKey(-1)) return;
		p_n = (*p_n).getNext();
	}
	
	linkNode((*p_n).getPrev(), (*p_n).getNext());
}

void LinkedList::deleteFirst()
{
	linkNode(p_dummy, (*p_dummy).getNext().getNext());
}

void LinkedList::deleteLast()
{
	linkNode((*p_dummy).getPrev().getPrev(), p_dummy);
}

void LinkedList::print()
{
	Node *p_n = (*p_dummy).getNext();
	if ((*p_n).hasKey(-1)) return;
	while (1) {
		(*p_n).printKey();
		p_n = (*p_n).getNext();
		if ((*p_n).hasKey(-1)){
			cout << endl;
			break;
		} else {
			cout << " ";
		}
	}
}

//
int main(void)
{	
	LinkedList list;
	
	int n;
	cin >> n;
	
	for (int i = 0; i < n; i++) {
		char command[12] = "\0";
		sin >> command;
		if (strcmp(command, "insert") == 0) {
			list.insertNode(cin);
		} else if (strcmp(command, "delete") == 0) {
			list.deleteNode(cin);
		} else if (strcmp(command, "deleteFirst") == 0) {
			list.deleteFirst();
		} else {
			list.deleteLast();
		}
	}

	list.print();
	
	return 0;
}

Compiler output:
a.cc:64:14: error: 'void LinkedList::linkNode(Node*, Node*)' cannot be overloaded with 'void LinkedList::linkNode(Node*, Node*)'
   64 |         void linkNode(Node *p_n1, Node *p_n2);
      |              ^~~~~~~~
a.cc:61:14: note: previous declaration 'void LinkedList::linkNode(Node*, Node*)'
   61 |         void linkNode(Node *p_n1, Node *p_n2);
      |              ^~~~~~~~
a.cc: In member function 'void LinkedList::deleteFirst()':
a.cc:106:48: error: request for member 'getNext' in '((LinkedList*)this)->LinkedList::p_dummy->Node::getNext()', which is of pointer type 'Node*' (maybe you meant to use '->' ?)
  106 |         linkNode(p_dummy, (*p_dummy).getNext().getNext());
      |                                                ^~~~~~~
a.cc: In member function 'void LinkedList::deleteLast()':
a.cc:111:39: error: request for member 'getPrev' in '((LinkedList*)this)->LinkedList::p_dummy->Node::getPrev()', which is of pointer type 'Node*' (maybe you meant to use '->' ?)
  111 |         linkNode((*p_dummy).getPrev().getPrev(), p_dummy);
      |                                       ^~~~~~~
a.cc: In function 'int main()':
a.cc:140:17: error: 'sin' was not declared in this scope
  140 |                 sin >> command;
      |                 ^~~
a.cc:142:41: error: cannot convert 'std::istream' {aka 'std::basic_istream<char>'} to 'int'
  142 |                         list.insertNode(cin);
      |                                         ^~~
      |                                         |
      |                                         std::istream {aka std::basic_istream<char>}
a.cc:86:33: note:   initializing argument 1 of 'void LinkedList::insertNode(int)'
   86 | void LinkedList::insertNode(int x)
      |                             ~~~~^
a.cc:144:41: error: cannot convert 'std::istream' {aka 'std::basic_istream<char>'} to 'int'
  144 |                         list.deleteNode(cin);
      |                                         ^~~
      |                                         |
      |                                         std::istream {aka std::basic_istream<char>}
a.cc:93:33: note:   initializing argument 1 of 'void LinkedList::deleteNode(int)'
   93 | void LinkedList::deleteNode(int x)
      |                             ~~~~^