Welcome to Dream.In.Code
Getting Help is Easy!

Join 132,619 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,005 people online right now. Registration is fast and FREE... Join Now!




CLASSES

 
Reply to this topicStart new topic

CLASSES, Method vs SUBCLASS

jhjinc
post 21 Apr, 2006 - 08:19 AM
Post #1


New D.I.C Head

*
Joined: 21 Apr, 2006
Posts: 2


My Contributions


When a new method is required to access a CLASS, how does one decide whether to create a new SUBCLASS or simply add a new method to the SUPERCLASS?
User is offlineProfile CardPM

Go to the top of the page

Nova Dragoon
post 21 Apr, 2006 - 08:25 AM
Post #2


The Innocent Shall Suffer, Big Time

Group Icon
Joined: 16 Aug, 2001
Posts: 6,128



Thanked 4 times

Dream Kudos: 515

Expert In: Python, Linux

My Contributions


What language are you using?

moving to gen programming
User is offlineProfile CardPM

Go to the top of the page

jhjinc
post 21 Apr, 2006 - 09:51 AM
Post #3


New D.I.C Head

*
Joined: 21 Apr, 2006
Posts: 2


My Contributions


C++
User is offlineProfile CardPM

Go to the top of the page

William_Wilson
post 21 Apr, 2006 - 09:35 PM
Post #4


lost in compilation

Group Icon
Joined: 23 Dec, 2005
Posts: 3,970



Thanked 15 times

Dream Kudos: 3275

Expert In: Java, C, Javascript

My Contributions


if the code in question has local variables which need to have seperate copies, or if the code should be treated as an object with individual status (eg: aPerson.print()) then it should be a class, or subclass.
If the code simply takes in parameters and does a calculation or some specific non-individual task, then a method is what you are looking for smile.gif

Basically a class can be instatiated, and a method cannot, but remember that they can both have pointers though functors, and method/funtion pointers are not necessary, they are only for convenience.
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/23/08 03:17AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month