Implementation of linked list in C++ using class
I created a linked list in C++ using class with few methods to provide interface for it.
Methods are pushFront()
, traverse()
and few more as shown below. PushFront
is used to insert the data at the head of linked list at any given time. traverse
is to display the linked list at any time. My code is shown below:
#include <iostream>
using namespace std;
class SingleLL{
private:
struct Node
{
int data;
Node * next;
};
Node * head;
Node * tail;
public:
SingleLL();
void pushFront(int i);
int topFront();
void popFront();
void pushBack(int i);
int topBack();
void popBack();
bool find(int key);
void erase(int key);
void addBefore(int beforekey,int key);
void addAfter(int afterkey,int key);
bool empty();
void traverse();
};
SingleLL::SingleLL(){
head = nullptr;
tail = nullptr;
}
void SingleLL::pushFront(int i)
{
Node * newNode =new Node;
newNode->data=i;
newNode->next=head;
head=newNode;
if(tail==nullptr)
tail = head;
}
int SingleLL::topFront()
{
if(empty())
{
cout<<"No element at the front top.n";
return 0;
}
return head->data;
}
void SingleLL::popFront()
{
if (empty()){
cout<<"No element to pop.n";
return;
}
head=head->next;
if(head==nullptr)
tail=nullptr;
}
void SingleLL::traverse()
{
if (empty())
cout<<"empty list. add elements";
Node * ptr = head;
while(ptr!=nullptr)
{
cout<<ptr->data;
ptr=ptr->next;
}
}
bool SingleLL::empty()
{
return head==nullptr;
}
int SingleLL::topBack()
{
if(empty())
{
cout<<"No element at the back top.n";
return 0;
}
return tail->data;
}
void SingleLL::popBack()
{
if(empty()){
cout<<"No element to popn";
return;
}
Node *ptr=head;
if(head->next==nullptr)
{
head=nullptr;
tail=nullptr;
}
while(ptr->next->next != nullptr)
{
ptr=ptr->next;
}
tail=ptr;
ptr->next=nullptr;
}
void SingleLL::pushBack(int i)
{
Node * newNode2 =new Node;
newNode2->data=i;
newNode2->next=nullptr;
if(tail!=nullptr)
tail->next=newNode2;
tail=newNode2;
if(head==nullptr)
head=tail;
}
bool SingleLL::find(int key)
{
if(head == nullptr)
return false;
Node * boolfinder = head;
while(boolfinder->next!=nullptr)
{
if(boolfinder->data==key)
{
return true;
}
boolfinder=boolfinder->next;
}
return false;
}
void SingleLL::erase(int key)
{
if(find(key))
{
if (head->data==key)
{
popFront();
return;
}
if(tail->data==key)
{
popBack();
return;
}
Node * finderprev = head;
Node * findererase = head->next;
while(findererase!=nullptr)
{
if(findererase->data==key)
{
finderprev->next=findererase->next;
free(findererase);
break;
}
findererase=findererase->next;
finderprev=finderprev->next;
}
}
else
cout<<"There is no such key to erase";
}
void SingleLL::addAfter(int afterkey,int key)
{
Node * newNode =new Node;
newNode->data=key;
Node * ptr = head;
while(ptr!=nullptr)
{
if(ptr->data==afterkey)
{
newNode->next=ptr->next;
ptr->next=newNode;
if(newNode->next==nullptr)
tail=newNode;
return;
}
ptr=ptr->next;
}
cout<<"There is no "<<afterkey<<" key to add "<<key<<" key before it.";
}
void SingleLL::addBefore(int keybefore,int key)
{
if(head->data==keybefore)
{
pushFront(key);
return;
}
Node * newNode1 = new Node;
newNode1->data=key;
Node *ptr = head->next;
Node *ptrprev = head;
while(ptr!=nullptr)
{
if(ptr->data==keybefore)
{
newNode1->next=ptr;
ptrprev->next=newNode1;
return;
}
ptr=ptr->next;
ptrprev=ptrprev->next;
}
cout<<"There is no"<<keybefore<<" key to add "<<key<<" key before it.";
}
int main()
{
SingleLL l1;
for(int i=10;i>=1;i--)
l1.pushFront(i);
l1.traverse();
l1.popFront();
cout<<"n";
l1.traverse();
for(int i=0;i<8;i++)
l1.popFront();
cout<<"n";
l1.traverse();
l1.popFront();
l1.popFront();
l1.popBack();
if(l1.empty())
cout<<"linked list is empty.n";
l1.topBack();
l1.popBack();
return 0;
}
I know that many things that I have used is not upto mark, like I have used struct like in old c where it contains data only. I have seen implementation of linked list using class in few other languages like java and python. But since C++ takes many or we can say all features from c language and adds O.O.P.to that, there are many things different in this language. Can anyone provide me the valuable code review and point out what are the things that I need to improve in my coding style. And how can I improve my O.O.P. design skills. What are the mistakes in this code? And also what changes should I do to make it full modern powerful C++ code?
And even though I will try it myself anyways i need valuable insight from this community on how to templatize or make this class generic so that it takes any atomic data type not only integer type as it does now.
c++ linked-list
New contributor
add a comment |
I created a linked list in C++ using class with few methods to provide interface for it.
Methods are pushFront()
, traverse()
and few more as shown below. PushFront
is used to insert the data at the head of linked list at any given time. traverse
is to display the linked list at any time. My code is shown below:
#include <iostream>
using namespace std;
class SingleLL{
private:
struct Node
{
int data;
Node * next;
};
Node * head;
Node * tail;
public:
SingleLL();
void pushFront(int i);
int topFront();
void popFront();
void pushBack(int i);
int topBack();
void popBack();
bool find(int key);
void erase(int key);
void addBefore(int beforekey,int key);
void addAfter(int afterkey,int key);
bool empty();
void traverse();
};
SingleLL::SingleLL(){
head = nullptr;
tail = nullptr;
}
void SingleLL::pushFront(int i)
{
Node * newNode =new Node;
newNode->data=i;
newNode->next=head;
head=newNode;
if(tail==nullptr)
tail = head;
}
int SingleLL::topFront()
{
if(empty())
{
cout<<"No element at the front top.n";
return 0;
}
return head->data;
}
void SingleLL::popFront()
{
if (empty()){
cout<<"No element to pop.n";
return;
}
head=head->next;
if(head==nullptr)
tail=nullptr;
}
void SingleLL::traverse()
{
if (empty())
cout<<"empty list. add elements";
Node * ptr = head;
while(ptr!=nullptr)
{
cout<<ptr->data;
ptr=ptr->next;
}
}
bool SingleLL::empty()
{
return head==nullptr;
}
int SingleLL::topBack()
{
if(empty())
{
cout<<"No element at the back top.n";
return 0;
}
return tail->data;
}
void SingleLL::popBack()
{
if(empty()){
cout<<"No element to popn";
return;
}
Node *ptr=head;
if(head->next==nullptr)
{
head=nullptr;
tail=nullptr;
}
while(ptr->next->next != nullptr)
{
ptr=ptr->next;
}
tail=ptr;
ptr->next=nullptr;
}
void SingleLL::pushBack(int i)
{
Node * newNode2 =new Node;
newNode2->data=i;
newNode2->next=nullptr;
if(tail!=nullptr)
tail->next=newNode2;
tail=newNode2;
if(head==nullptr)
head=tail;
}
bool SingleLL::find(int key)
{
if(head == nullptr)
return false;
Node * boolfinder = head;
while(boolfinder->next!=nullptr)
{
if(boolfinder->data==key)
{
return true;
}
boolfinder=boolfinder->next;
}
return false;
}
void SingleLL::erase(int key)
{
if(find(key))
{
if (head->data==key)
{
popFront();
return;
}
if(tail->data==key)
{
popBack();
return;
}
Node * finderprev = head;
Node * findererase = head->next;
while(findererase!=nullptr)
{
if(findererase->data==key)
{
finderprev->next=findererase->next;
free(findererase);
break;
}
findererase=findererase->next;
finderprev=finderprev->next;
}
}
else
cout<<"There is no such key to erase";
}
void SingleLL::addAfter(int afterkey,int key)
{
Node * newNode =new Node;
newNode->data=key;
Node * ptr = head;
while(ptr!=nullptr)
{
if(ptr->data==afterkey)
{
newNode->next=ptr->next;
ptr->next=newNode;
if(newNode->next==nullptr)
tail=newNode;
return;
}
ptr=ptr->next;
}
cout<<"There is no "<<afterkey<<" key to add "<<key<<" key before it.";
}
void SingleLL::addBefore(int keybefore,int key)
{
if(head->data==keybefore)
{
pushFront(key);
return;
}
Node * newNode1 = new Node;
newNode1->data=key;
Node *ptr = head->next;
Node *ptrprev = head;
while(ptr!=nullptr)
{
if(ptr->data==keybefore)
{
newNode1->next=ptr;
ptrprev->next=newNode1;
return;
}
ptr=ptr->next;
ptrprev=ptrprev->next;
}
cout<<"There is no"<<keybefore<<" key to add "<<key<<" key before it.";
}
int main()
{
SingleLL l1;
for(int i=10;i>=1;i--)
l1.pushFront(i);
l1.traverse();
l1.popFront();
cout<<"n";
l1.traverse();
for(int i=0;i<8;i++)
l1.popFront();
cout<<"n";
l1.traverse();
l1.popFront();
l1.popFront();
l1.popBack();
if(l1.empty())
cout<<"linked list is empty.n";
l1.topBack();
l1.popBack();
return 0;
}
I know that many things that I have used is not upto mark, like I have used struct like in old c where it contains data only. I have seen implementation of linked list using class in few other languages like java and python. But since C++ takes many or we can say all features from c language and adds O.O.P.to that, there are many things different in this language. Can anyone provide me the valuable code review and point out what are the things that I need to improve in my coding style. And how can I improve my O.O.P. design skills. What are the mistakes in this code? And also what changes should I do to make it full modern powerful C++ code?
And even though I will try it myself anyways i need valuable insight from this community on how to templatize or make this class generic so that it takes any atomic data type not only integer type as it does now.
c++ linked-list
New contributor
2
Welcome to Code Review. I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
– Heslacher
23 hours ago
1
Thank you very much. Okay once i fix this i will ask review for it.
– shishir jha
23 hours ago
1
Tested this on wandbox. Tests are passing. Voting for reopen.
– Incomputable
11 hours ago
C++ doesn't just bolt on OOP, but adds support for more paradigms. Pure OOP isn't really good C++ anyways. And there is Nothing wrong with having a POD, especially as an implementation-detail.
– Deduplicator
9 hours ago
add a comment |
I created a linked list in C++ using class with few methods to provide interface for it.
Methods are pushFront()
, traverse()
and few more as shown below. PushFront
is used to insert the data at the head of linked list at any given time. traverse
is to display the linked list at any time. My code is shown below:
#include <iostream>
using namespace std;
class SingleLL{
private:
struct Node
{
int data;
Node * next;
};
Node * head;
Node * tail;
public:
SingleLL();
void pushFront(int i);
int topFront();
void popFront();
void pushBack(int i);
int topBack();
void popBack();
bool find(int key);
void erase(int key);
void addBefore(int beforekey,int key);
void addAfter(int afterkey,int key);
bool empty();
void traverse();
};
SingleLL::SingleLL(){
head = nullptr;
tail = nullptr;
}
void SingleLL::pushFront(int i)
{
Node * newNode =new Node;
newNode->data=i;
newNode->next=head;
head=newNode;
if(tail==nullptr)
tail = head;
}
int SingleLL::topFront()
{
if(empty())
{
cout<<"No element at the front top.n";
return 0;
}
return head->data;
}
void SingleLL::popFront()
{
if (empty()){
cout<<"No element to pop.n";
return;
}
head=head->next;
if(head==nullptr)
tail=nullptr;
}
void SingleLL::traverse()
{
if (empty())
cout<<"empty list. add elements";
Node * ptr = head;
while(ptr!=nullptr)
{
cout<<ptr->data;
ptr=ptr->next;
}
}
bool SingleLL::empty()
{
return head==nullptr;
}
int SingleLL::topBack()
{
if(empty())
{
cout<<"No element at the back top.n";
return 0;
}
return tail->data;
}
void SingleLL::popBack()
{
if(empty()){
cout<<"No element to popn";
return;
}
Node *ptr=head;
if(head->next==nullptr)
{
head=nullptr;
tail=nullptr;
}
while(ptr->next->next != nullptr)
{
ptr=ptr->next;
}
tail=ptr;
ptr->next=nullptr;
}
void SingleLL::pushBack(int i)
{
Node * newNode2 =new Node;
newNode2->data=i;
newNode2->next=nullptr;
if(tail!=nullptr)
tail->next=newNode2;
tail=newNode2;
if(head==nullptr)
head=tail;
}
bool SingleLL::find(int key)
{
if(head == nullptr)
return false;
Node * boolfinder = head;
while(boolfinder->next!=nullptr)
{
if(boolfinder->data==key)
{
return true;
}
boolfinder=boolfinder->next;
}
return false;
}
void SingleLL::erase(int key)
{
if(find(key))
{
if (head->data==key)
{
popFront();
return;
}
if(tail->data==key)
{
popBack();
return;
}
Node * finderprev = head;
Node * findererase = head->next;
while(findererase!=nullptr)
{
if(findererase->data==key)
{
finderprev->next=findererase->next;
free(findererase);
break;
}
findererase=findererase->next;
finderprev=finderprev->next;
}
}
else
cout<<"There is no such key to erase";
}
void SingleLL::addAfter(int afterkey,int key)
{
Node * newNode =new Node;
newNode->data=key;
Node * ptr = head;
while(ptr!=nullptr)
{
if(ptr->data==afterkey)
{
newNode->next=ptr->next;
ptr->next=newNode;
if(newNode->next==nullptr)
tail=newNode;
return;
}
ptr=ptr->next;
}
cout<<"There is no "<<afterkey<<" key to add "<<key<<" key before it.";
}
void SingleLL::addBefore(int keybefore,int key)
{
if(head->data==keybefore)
{
pushFront(key);
return;
}
Node * newNode1 = new Node;
newNode1->data=key;
Node *ptr = head->next;
Node *ptrprev = head;
while(ptr!=nullptr)
{
if(ptr->data==keybefore)
{
newNode1->next=ptr;
ptrprev->next=newNode1;
return;
}
ptr=ptr->next;
ptrprev=ptrprev->next;
}
cout<<"There is no"<<keybefore<<" key to add "<<key<<" key before it.";
}
int main()
{
SingleLL l1;
for(int i=10;i>=1;i--)
l1.pushFront(i);
l1.traverse();
l1.popFront();
cout<<"n";
l1.traverse();
for(int i=0;i<8;i++)
l1.popFront();
cout<<"n";
l1.traverse();
l1.popFront();
l1.popFront();
l1.popBack();
if(l1.empty())
cout<<"linked list is empty.n";
l1.topBack();
l1.popBack();
return 0;
}
I know that many things that I have used is not upto mark, like I have used struct like in old c where it contains data only. I have seen implementation of linked list using class in few other languages like java and python. But since C++ takes many or we can say all features from c language and adds O.O.P.to that, there are many things different in this language. Can anyone provide me the valuable code review and point out what are the things that I need to improve in my coding style. And how can I improve my O.O.P. design skills. What are the mistakes in this code? And also what changes should I do to make it full modern powerful C++ code?
And even though I will try it myself anyways i need valuable insight from this community on how to templatize or make this class generic so that it takes any atomic data type not only integer type as it does now.
c++ linked-list
New contributor
I created a linked list in C++ using class with few methods to provide interface for it.
Methods are pushFront()
, traverse()
and few more as shown below. PushFront
is used to insert the data at the head of linked list at any given time. traverse
is to display the linked list at any time. My code is shown below:
#include <iostream>
using namespace std;
class SingleLL{
private:
struct Node
{
int data;
Node * next;
};
Node * head;
Node * tail;
public:
SingleLL();
void pushFront(int i);
int topFront();
void popFront();
void pushBack(int i);
int topBack();
void popBack();
bool find(int key);
void erase(int key);
void addBefore(int beforekey,int key);
void addAfter(int afterkey,int key);
bool empty();
void traverse();
};
SingleLL::SingleLL(){
head = nullptr;
tail = nullptr;
}
void SingleLL::pushFront(int i)
{
Node * newNode =new Node;
newNode->data=i;
newNode->next=head;
head=newNode;
if(tail==nullptr)
tail = head;
}
int SingleLL::topFront()
{
if(empty())
{
cout<<"No element at the front top.n";
return 0;
}
return head->data;
}
void SingleLL::popFront()
{
if (empty()){
cout<<"No element to pop.n";
return;
}
head=head->next;
if(head==nullptr)
tail=nullptr;
}
void SingleLL::traverse()
{
if (empty())
cout<<"empty list. add elements";
Node * ptr = head;
while(ptr!=nullptr)
{
cout<<ptr->data;
ptr=ptr->next;
}
}
bool SingleLL::empty()
{
return head==nullptr;
}
int SingleLL::topBack()
{
if(empty())
{
cout<<"No element at the back top.n";
return 0;
}
return tail->data;
}
void SingleLL::popBack()
{
if(empty()){
cout<<"No element to popn";
return;
}
Node *ptr=head;
if(head->next==nullptr)
{
head=nullptr;
tail=nullptr;
}
while(ptr->next->next != nullptr)
{
ptr=ptr->next;
}
tail=ptr;
ptr->next=nullptr;
}
void SingleLL::pushBack(int i)
{
Node * newNode2 =new Node;
newNode2->data=i;
newNode2->next=nullptr;
if(tail!=nullptr)
tail->next=newNode2;
tail=newNode2;
if(head==nullptr)
head=tail;
}
bool SingleLL::find(int key)
{
if(head == nullptr)
return false;
Node * boolfinder = head;
while(boolfinder->next!=nullptr)
{
if(boolfinder->data==key)
{
return true;
}
boolfinder=boolfinder->next;
}
return false;
}
void SingleLL::erase(int key)
{
if(find(key))
{
if (head->data==key)
{
popFront();
return;
}
if(tail->data==key)
{
popBack();
return;
}
Node * finderprev = head;
Node * findererase = head->next;
while(findererase!=nullptr)
{
if(findererase->data==key)
{
finderprev->next=findererase->next;
free(findererase);
break;
}
findererase=findererase->next;
finderprev=finderprev->next;
}
}
else
cout<<"There is no such key to erase";
}
void SingleLL::addAfter(int afterkey,int key)
{
Node * newNode =new Node;
newNode->data=key;
Node * ptr = head;
while(ptr!=nullptr)
{
if(ptr->data==afterkey)
{
newNode->next=ptr->next;
ptr->next=newNode;
if(newNode->next==nullptr)
tail=newNode;
return;
}
ptr=ptr->next;
}
cout<<"There is no "<<afterkey<<" key to add "<<key<<" key before it.";
}
void SingleLL::addBefore(int keybefore,int key)
{
if(head->data==keybefore)
{
pushFront(key);
return;
}
Node * newNode1 = new Node;
newNode1->data=key;
Node *ptr = head->next;
Node *ptrprev = head;
while(ptr!=nullptr)
{
if(ptr->data==keybefore)
{
newNode1->next=ptr;
ptrprev->next=newNode1;
return;
}
ptr=ptr->next;
ptrprev=ptrprev->next;
}
cout<<"There is no"<<keybefore<<" key to add "<<key<<" key before it.";
}
int main()
{
SingleLL l1;
for(int i=10;i>=1;i--)
l1.pushFront(i);
l1.traverse();
l1.popFront();
cout<<"n";
l1.traverse();
for(int i=0;i<8;i++)
l1.popFront();
cout<<"n";
l1.traverse();
l1.popFront();
l1.popFront();
l1.popBack();
if(l1.empty())
cout<<"linked list is empty.n";
l1.topBack();
l1.popBack();
return 0;
}
I know that many things that I have used is not upto mark, like I have used struct like in old c where it contains data only. I have seen implementation of linked list using class in few other languages like java and python. But since C++ takes many or we can say all features from c language and adds O.O.P.to that, there are many things different in this language. Can anyone provide me the valuable code review and point out what are the things that I need to improve in my coding style. And how can I improve my O.O.P. design skills. What are the mistakes in this code? And also what changes should I do to make it full modern powerful C++ code?
And even though I will try it myself anyways i need valuable insight from this community on how to templatize or make this class generic so that it takes any atomic data type not only integer type as it does now.
c++ linked-list
c++ linked-list
New contributor
New contributor
edited 11 mins ago
shishir jha
New contributor
asked 23 hours ago
shishir jhashishir jha
62
62
New contributor
New contributor
2
Welcome to Code Review. I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
– Heslacher
23 hours ago
1
Thank you very much. Okay once i fix this i will ask review for it.
– shishir jha
23 hours ago
1
Tested this on wandbox. Tests are passing. Voting for reopen.
– Incomputable
11 hours ago
C++ doesn't just bolt on OOP, but adds support for more paradigms. Pure OOP isn't really good C++ anyways. And there is Nothing wrong with having a POD, especially as an implementation-detail.
– Deduplicator
9 hours ago
add a comment |
2
Welcome to Code Review. I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
– Heslacher
23 hours ago
1
Thank you very much. Okay once i fix this i will ask review for it.
– shishir jha
23 hours ago
1
Tested this on wandbox. Tests are passing. Voting for reopen.
– Incomputable
11 hours ago
C++ doesn't just bolt on OOP, but adds support for more paradigms. Pure OOP isn't really good C++ anyways. And there is Nothing wrong with having a POD, especially as an implementation-detail.
– Deduplicator
9 hours ago
2
2
Welcome to Code Review. I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
– Heslacher
23 hours ago
Welcome to Code Review. I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
– Heslacher
23 hours ago
1
1
Thank you very much. Okay once i fix this i will ask review for it.
– shishir jha
23 hours ago
Thank you very much. Okay once i fix this i will ask review for it.
– shishir jha
23 hours ago
1
1
Tested this on wandbox. Tests are passing. Voting for reopen.
– Incomputable
11 hours ago
Tested this on wandbox. Tests are passing. Voting for reopen.
– Incomputable
11 hours ago
C++ doesn't just bolt on OOP, but adds support for more paradigms. Pure OOP isn't really good C++ anyways. And there is Nothing wrong with having a POD, especially as an implementation-detail.
– Deduplicator
9 hours ago
C++ doesn't just bolt on OOP, but adds support for more paradigms. Pure OOP isn't really good C++ anyways. And there is Nothing wrong with having a POD, especially as an implementation-detail.
– Deduplicator
9 hours ago
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
});
});
}, "mathjax-editing");
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "196"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
shishir jha is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f211166%2fimplementation-of-linked-list-in-c-using-class%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
shishir jha is a new contributor. Be nice, and check out our Code of Conduct.
shishir jha is a new contributor. Be nice, and check out our Code of Conduct.
shishir jha is a new contributor. Be nice, and check out our Code of Conduct.
shishir jha is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Code Review Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f211166%2fimplementation-of-linked-list-in-c-using-class%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
Welcome to Code Review. I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
– Heslacher
23 hours ago
1
Thank you very much. Okay once i fix this i will ask review for it.
– shishir jha
23 hours ago
1
Tested this on wandbox. Tests are passing. Voting for reopen.
– Incomputable
11 hours ago
C++ doesn't just bolt on OOP, but adds support for more paradigms. Pure OOP isn't really good C++ anyways. And there is Nothing wrong with having a POD, especially as an implementation-detail.
– Deduplicator
9 hours ago