How do I bring a class into a function??

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2008
Posts: 51
Reputation: Manutebecker is an unknown quantity at this point 
Solved Threads: 2
Manutebecker's Avatar
Manutebecker Manutebecker is offline Offline
Junior Poster in Training

How do I bring a class into a function??

 
0
  #1
Nov 18th, 2008
I want to be able to bring the single instance class into a function of another class without having to take each seperate little variable from the class and inject it in, can I just do something like

void Yeah(class *The Class)

and then pass the class in easily??? Or maybe even in a non pointer form?
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,441
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1474
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is online now Online
Still Learning

Re: How do I bring a class into a function??

 
0
  #2
Nov 18th, 2008
you could make one class derived from the other
  1. class A
  2. {
  3. ...
  4. };
  5.  
  6. class B : public A
  7. {
  8. ...
  9. };
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 2,047
Reputation: Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice 
Solved Threads: 139
Team Colleague
Rashakil Fol's Avatar
Rashakil Fol Rashakil Fol is offline Offline
Super Senior Demiposter

Re: How do I bring a class into a function??

 
1
  #3
Nov 19th, 2008
Don't follow Ancient Dragon's advice; it's horrible design.

What do you mean exactly by "single instance class"? Why don't you pass the instance by reference?
Last edited by Rashakil Fol; Nov 19th, 2008 at 2:27 am.
All my posts may be redistributed under the GNU Free Documentation License.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC