Quick polymorphism and subclassing question
Quick polymorphism and subclassing question
- Subject: Quick polymorphism and subclassing question
- From: Keith Blount <email@hidden>
- Date: Sun, 6 Mar 2005 16:48:52 -0800 (PST)
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
Hello,
A very basic question, I fear, but I would be very
grateful if someone could clear this one up for me by
explaining to me the proper way of doing things:
Suppose I subclass NSTextView and call my subclass
KBTextView. Then I use this subclassed text view as an
instance variable in another class and want to provide
an accessor method to it. What would be the proper way
of creating a name for this method? I have been doing
this:
- (KBTextView *)textView;
However, NSTextStorage has a -(NSTextView *)textView
method. Is this a violation of the principles of
polymorphism? Should all methods with the same name
have exactly the same return type? ie. Would it be
better to have an accessor method with a different
name to indicate the different return type, such as:
- (KBTextView *)kbTextView;
This is probably very obvious, but I would be very
thankful if someone could enlighten me.
Many thanks,
Keith
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden