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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:06:45+00:00 2026-05-21T03:06:45+00:00

Specifically, I would like to share a set of utility methods between NSTreeNode and

  • 0

Specifically, I would like to share a set of utility methods between NSTreeNode and my class which is not a subclass of NSTreeNode. My class (WCTreeNode) inherits from WCObject, which is a subclass of NSObject.

My current solution is to have the methods declared in the header of my class (WCTreeNode) and then again in a category on NSTreeNode. However, I’m not particularly fond of this because whenever I make changes, I have to make sure to do it in both files.

I realize I could just make a category on NSObject and list the methods there, but that doesn’t seem specific enough to me and doesn’t let the compiler help me as much with respect to type-checking.

I’d really like a solution that allows me to keep the code in a single file so I don’t have to change things in multiple places each time.

Any suggestions?

  • 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-21T03:06:46+00:00Added an answer on May 21, 2026 at 3:06 am

    I think a protocol is the way to go here. Put your custom methods in a protocol, and subclass NSTreeNode; the only customization this subclass would make would be to adopt the protocol. WCTreeNode can also adopt the protocol. This allows type-checking and keeps the methods in one place.

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

Sidebar

Related Questions

I would like someone to try and explain the difference between these. More specifically,
I would like to add custom tooltips to emacs. More specifically, whenever I hover
I would like to begin developing for the Blackberry platform and, specifically, the Bold
I would like to connect to a DB2 database, specifically an iSeries version, using
Specifically for Twisted, I would like to be able to determine whether the server
Specifically, I would like to know how the view model is to be bound
I have a form that I would like to style. specifcally I would like
On the UNIX bash shell (specifically Mac OS X Leopard) what would be the
[This is for PC/Visual C++ specifically (although any other answers would be quite illuminating
Although I'm specifically interested in web application information, I would also be somewhat curious

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.