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 191829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:22:28+00:00 2026-05-11T16:22:28+00:00

I was looking at a library a person has made for FaceBook in C++.

  • 0

I was looking at a library a person has made for FaceBook in C++. The header file is this:

#ifndef __FACEBOOK_H__
#define __FACEBOOK_H__

/**
 * Facebook Class 
 * Joel Seligstein
 * Last mod: Aug 22, 2006
 *
 * This is the beginnings of a facebook class set and REST client.  Its not documented
 * yet nor nearly complete.  But this is a release to demonstrate its usefulness.  
 * Please email joel@seligstein.com with suggestions or additions.
 *
 * TODO: Create classes/parsers for each request type
 * TODO: Linux URL launcher
 */

//uncomment to have verbose output turned on
//#define fb_debug 1

//define which platform you're compiling for
#define fb_windows 1
//#define fb_linux 1

#include <string>
#include <sstream>
#include <list>
using namespace std;

#ifdef fb_windows
#include <windows.h>
#endif

#include "curl/curl.h"
#include "xmlParser/xmlParser.h"
#include "md5.h"

class facebook
{
    public:
        //app/session vars
        string api_key;
        string secret;
        string token;
        string server;
        string session_key;
        string session_secret;
        string uid;
        bool has_session;

        facebook( string my_key, string my_secret, string my_server );
        bool authenticate( );
        bool request( string method, list<string> params, string *res );
        bool load_token( );
        void launch_login( string url );
        bool get_session( );
        void clean_up( );

    private:
        //curl info
        CURL *curl;
        CURLcode res;
        int call_id;

        //internal functions
        string get_signature( list<string> params );
        static string md5( string str );
        static string get_param_string( list<string> params, bool separate );
        static size_t write_callback( void *ptr, size_t size, size_t nmemb, void *userp );
};

#endif //__FACEBOOK_H__

Then inside the cpp file, my question is regarding this, the below is the constructor:

facebook::facebook( string my_key, string my_secret, string my_server )
{
    this->api_key = my_key;
    this->secret = my_secret;
    this->server = my_server;
    this->has_session = false;
    this->call_id = 0;
}

Why have they used the -> operator and not .?

I have a limited understanding that -> accesses properties and methods of the type directly in memory but I am confused, I would, through ignorance, expect to see:

facebook::facebook( string my_key, string my_secret, string my_server )
{
    this.api_key = my_key;
    this.secret = my_secret;
    this.server = my_server;
    this.has_session = false;
    this.call_id = 0;
}

All I want to know is the theory behind why -> is used over the dot notation.


UPDATE:
For anyone else in the same boat as me and learning C++. I have expanded on an example posted by a member in this question. I have also wrapped in initialization list for a member field.

#include "stdafx.h"
#include <iostream>
using namespace std;

class A {
private:
    int x;
public:
    A() : x(0){}
    int getX() const {return x;}
    void setX(int xx) {x += xx;}
};

int main()
{
    A a;

    a.setX(13);

    A *pa = &a;

    pa->setX(2);

    A b = a;

    b.setX(5);

    cout << "a" << a.getX() << endl;

    cout << "a*" << pa->getX() << endl;

    cout << "b" << b.getX() << endl;

    return 0;
}
  • 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-11T16:22:29+00:00Added an answer on May 11, 2026 at 4:22 pm

    this is a pointer to the current object i.e., inside methods (or constructor) of class A, this is of type A *.

    (Note that, if the method is tagged as const, this is of type A const *.)

    Hence the use of -> (designed only for pointers) and not . (designed only for class objects A or references to class objects A&).

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

Sidebar

Related Questions

I am looking for a library (.jar) which help me to convert sound file
I'm looking for a library like Cairo, just far faster. It has to be
I'm looking for a library to read a SWF file and let me parse
I'm looking for a library which do this : Retrieve a JSON through an
Looking for a library or a fairly cross platform method to get CPU utilization,
I was looking for some library that make easier the manage of the box
I'm looking for a library/framework to generate/parse TXT files from/into Java objects. I'm thinking
I am looking for a library that allows me to read an Excel document
I am looking for a library or database that can provide guesses about whether
I'm looking for a library that will disassemble x86 code into some sort of

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.