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

  • SEARCH
  • Home
  • 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 9199787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:36:56+00:00 2026-06-17T22:36:56+00:00

I have the following in an implementation file… void ClientList::interestCompare(vector<string> intr) { for(int index

  • 0

I have the following in an implementation file…

void ClientList::interestCompare(vector<string> intr)
{
    for(int index = 0; index < intr.size(); index++)
    {
        this->interests[index];  
    }
}

and this in the specification file…

class ClientList
{
private:
// A structure for the list
struct ListNode
    {
        char gender;
        string name;
        string phone;
        int numInterests; // The number of interests for the client
        vector<string> interests; // list of interests
        string match;
        struct ListNode *next;  // To point to the next node
    }; 
//more stuff
...}

is it possible to use the “this” pointer to access the “interests” vector in the struct?

If so how.

As I have it now, I initialize a ListNode pointer to head in order to access the list. I’m just wondering if the “this” pointer can only access members of the class, or if they can access deeper ADT variables embedded in the class.

Does that question even make sense?

  • 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-06-17T22:36:57+00:00Added an answer on June 17, 2026 at 10:36 pm

    You only declared a ListNode type inside ClientList class which doesn’t mean you have a instance of ClientList. As you hare using std::vector already, you could use std::vector or std::list instead of implementing another list

    class ClientList
    {
    private:
    // A structure for the list
      struct Client
      {
        char gender;
        std::string name;
        std::string phone;
        int numInterests; // The number of interests for the client
        std::vector<string> interests; // list of interests
        std::string match;
       }; 
       std::vector<Client> clients;
      //more stuff
    };
    

    Edit:

    If you want to compare two lists, use std::set_intersection, it requires two containers to be sorted in place.

    void ClientList::FindClientHasCommonInterest(const vector<string>& intr)
    {
       for(auto client = clients.begin(); client != clients.end(); ++client)
       {
          std::vector<std::string> intereste_in_common;
           std::set_intersection((*client).begin(), (*client).end(), 
                                 intr.begin(), intr.end(), 
                                 std::back_inserter(intereste_in_common));
           if (intereste_in_common.size() >= 3)
           {
                // find one client
           }
       }  
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given I have two File objects I can think of the following implementation: public
I have this following codes: @implementation MyImageView @synthesize image; //image is a UIImage -
I have the following own Interface Implementation in my Fragment: @Override public void onReportChanged(Fragment
I have an implementation of lazyDataModel following this tutorial http://uaihebert.com/?p=1120 My code its a
This is what I have in my implementation file for one of my classes...
If I have the following class A { public: int stuff; void helper(B temp,
So, I have the following in a specification file #include <string> #include <fstream> using
I have the following code implementation of my generic singleton provider: public sealed class
I have the following scenario.The implementation is required for a real time application. 1)I
I have a problem with the following implementation of hook_cron in Drupal 6.1.3. The

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.