• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
using a virtual C++ function
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

using a virtual C++ function


  • Subject: using a virtual C++ function
  • From: Robert Palmer Jr <email@hidden>
  • Date: Mon, 9 Jun 2003 16:48:35 -0400

I'm trying to learn Cocoa and Objective C (for about the 3rd or 4th time). I've looked through the archives for an answer, but haven't found one.

I have a C++ class with a virtual function that is expected to be overridden.

class SensorFinder
{
public:
SensorFinder();
virtual ~SensorFinder();

void search();
virtual void sensorFound(char hwAddr[6]){};
}


When search() is called, it queries the network for sensors. For each sensor found, search calls the sensorFound() function. This is an interface to the searching core. To use this, your "real" app would derive from SensorFinder and implement sensorFound() and do something (build a table/NSMutableArray) with each sensor found.

Now, I want to USE this in a cocoa application. Unfortunately, I can't derive an objective-C class from a C++ class. I want to create an NSTableView dataSource object and use this SensorFinder class to populate it. What is the best way to go about this???

Thanks,
-----------------------------
Robert G. Palmer, Jr.
email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: using a virtual C++ function
      • From: Oscar Morales Vivó <email@hidden>
    • Re: using a virtual C++ function
      • From: "Florian G\. Pflug" <email@hidden>
  • Prev by Date: Re: C question for you old guys ;-)
  • Next by Date: Re: [OT] Where to get short sounds?
  • Previous by thread: Re: PPP Control
  • Next by thread: Re: using a virtual C++ function
  • Index(es):
    • Date
    • Thread