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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:12:34+00:00 2026-05-13T06:12:34+00:00

I would like to add notification center from a cpp class, is it possible????

  • 0

I would like to add notification center from a cpp class, is it possible????

If so, how do I do it?

Manager.h

class Manager
{

  Manager();

};

Manger.mm file

Manager:Manager()
{
[[NSNotificationCenter dafaultCenter] addObserver:self selector:@selector(workermethod) name:@" Name" object:(id)nil];
}

My compiler gives an error saying self is not declared…….yes i know it is an obvious error.

Since I’m not deriving from NSObject….
Please let me know if it is possible to add notification center to cpp class in Cocoa??

  • 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-13T06:12:34+00:00Added an answer on May 13, 2026 at 6:12 am

    No, you can’t do that.

    The Objective-C and C++ class hierarchies are separate. In a C++ context, self is not defined but this is defined. In an Objective-C context, this is not defined and self is.

    Also, addObserver takes an id parameter. C++ object instances are not considered of type id so even if you change your code to pass this instead of self it won’t compile.

    See the C++ Limitations from the Objective-C Programming Language Manual.

    As a workaround, create an Objectve-C class which has an instance of the C++ object you want the notification to go to, and simply call the C++ method on it when the Objective-C object gets the notification.

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

Sidebar

Ask A Question

Stats

  • Questions 293k
  • Answers 293k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The correct script tag attribute for indicating the location of… May 13, 2026 at 6:22 pm
  • Editorial Team
    Editorial Team added an answer This BP check is implemented in SysBPCheckMenuFunction.checkSecurityKey(). It looks like… May 13, 2026 at 6:22 pm
  • Editorial Team
    Editorial Team added an answer Web workers are deliberately shared-nothing -- everything in a worker… May 13, 2026 at 6:22 pm

Related Questions

I have a UITabBar + UINavigationController application which often needs data from the internet.
I have a bash script activated by crontab and running in background. I would
Remember the little div that shows up at the top of the page to
Im getting frustrated because of OpenDNS and other services (ie: roadrunner) that now always
I'd like to make a series of components into a solid, consistently repeatable object.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.