Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4333140
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:21:09+00:00 2026-05-21T10:21:09+00:00

I have a class that implements a linked list. The class has a find()

  • 0

I have a class that implements a linked list. The class has a find() method which finds a value if it exists in the linked list. I have another method add() which adds a node, but ONLY if that value contained in that node does NOT already exist in the list.

So what I want to do in my add() function is use my find method instead of testing for an existing value since that’d be like implementing it a second time. My question is, how can I call the find method from within another method in that class?

I tried calling
this.find(x)

But that gave me errors.

Here is what some of my code looks like:

// main function
  SLList<int>list;
  list.add(20);
  list.add(14);

// SLList.h (interface and implementation)

template<typename T>
bool SLList<T>::find(const T& val) const {
  // finds value
}


template<typename T>
void SLList<T>::add(const T& x) {
  bool found = this.find(x);
  if (found) return false;

  // goes on to add a node in the Singly Linked list (SLList)
}

So Like I said, I want to be able to call the find method from within another method in that class, and I thought all I’d have to do for that is refer to the calling object, and then call it’s find method, but as I said, this gives me a bunch of errors.

Anyone help me out with how I can call this, thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T10:21:10+00:00Added an answer on May 21, 2026 at 10:21 am

    Just call find(x). No this required. Also, this is a pointer to the current object. So you would have to do this->find(x).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, I have a Linked List which implements a display() function that simply loops
So basically I have a Linked List class that has all of the constructor
I have an assignment that requires us to implement a doubly linked list class.
I have a generic list class that implements a particular interface. The list items
I have a class that implements the IDisposable interface. I am using a webclient
I have a class that implements properties in a specific way, to handle some
I have a class that implements IComparable. public class MyClass : IComparable<MyClass> { public
I have a class that implements InvocationHandler as below: public class MyProxyClass implements InvocationHandler
When I have a class that implements INotifyPropertyChanged, is it ok to expose the
Context: I have a class that implements a Session, maintaining a TCP connection to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.