User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 426,503 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,231 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 530 | Replies: 11
Reply
Join Date: Apr 2008
Location: Kyrgyzstan
Posts: 4
Reputation: WondererAbu is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
WondererAbu WondererAbu is offline Offline
Newbie Poster

SMS(student managent system)

  #1  
May 12th, 2008
Can you explain me how to link classes with each other?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2007
Location: India
Posts: 289
Reputation: Agni is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 38
Sponsor
Agni's Avatar
Agni Agni is offline Offline
Posting Whiz in Training

Re: SMS(student managent system)

  #2  
May 12th, 2008
... dude.... what do you mean by 'link classes' ?
thanks
-chandra
Reply With Quote  
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 11,184
Reputation: Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of 
Rep Power: 38
Solved Threads: 930
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: SMS(student managent system)

  #3  
May 12th, 2008
You could use a std::vector, or std::list, or write your own linked list. If that isn't what you want then we have no idea what you mean.
I think it's about time we voted for senators with breasts. After all, we've been voting for boobs long enough. ~Clarie Sargent, Arizona senatorial candidate
Those who are too smart to engage in politics are punished by being governed by those who are dumber. ~Plato
Reply With Quote  
Join Date: Dec 2006
Location: india
Posts: 1,074
Reputation: vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all 
Rep Power: 9
Solved Threads: 161
vijayan121 vijayan121 is offline Offline
Veteran Poster

Re: SMS(student managent system)

  #4  
May 12th, 2008
> how to link classes with each other?
classes are types. are you looking for how to implement a typelist?
a tutorial introduction to typelists: http://www.ddj.com/cpp/184403813?_requestid=1305388
you might then want to read Alexandrescu's Modern C++ Design (Addison-Wesley Longman, 2001).
and look up Boost.MPL http://www.boost.org/doc/libs/1_35_0...doc/index.html which has a ready made framework for template metaprogramming. eg.
  1. #include <boost/mpl/vector.hpp>
  2. #include <boost/mpl/push_front.hpp>
  3. #include <boost/mpl/push_back.hpp>
  4. #include <boost/mpl/replace.hpp>
  5. #include <boost/mpl/at.hpp>
  6. #include <boost/mpl/int.hpp>
  7. #include <boost/mpl/assert.hpp>
  8.  
  9. class A{} ; class B{} ; class C{} ; class D{} ; class E{} ;
  10.  
  11. int main()
  12. {
  13. using namespace boost ;
  14.  
  15. typedef mpl::vector<A,B> seq_ab ;
  16. typedef mpl::push_front< seq_ab, C >::type seq_cab ;
  17. typedef mpl::push_back< seq_cab, D >::type seq_cabd ;
  18. typedef mpl::replace< seq_cabd, B, E >::type seq_caed ;
  19.  
  20. BOOST_MPL_ASSERT(
  21. ( mpl::is_same< mpl::at< seq_caed, mpl::int_<2> >, E > ) ) ;
  22. }
Reply With Quote  
Join Date: Apr 2008
Location: Kyrgyzstan
Posts: 4
Reputation: WondererAbu is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
WondererAbu WondererAbu is offline Offline
Newbie Poster

Re: SMS(student managent system)

  #5  
May 19th, 2008
Originally Posted by Agni View Post
... dude.... what do you mean by 'link classes' ?


There are many classes which must be link or in other words put together in order to work as one big class.
Reply With Quote  
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 11,184
Reputation: Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of 
Rep Power: 38
Solved Threads: 930
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: SMS(student managent system)

  #6  
May 19th, 2008
Originally Posted by WondererAbu View Post
There are many classes which must be link or in other words put together in order to work as one big class.


Oh, do you mean inheritence?
class base
{
   // blabla
};

class derived : public base
{
    // linked (derived) class
};
I think it's about time we voted for senators with breasts. After all, we've been voting for boobs long enough. ~Clarie Sargent, Arizona senatorial candidate
Those who are too smart to engage in politics are punished by being governed by those who are dumber. ~Plato
Reply With Quote  
Join Date: May 2006
Location: ★ ijug.net ★
Posts: 939
Reputation: ithelp will become famous soon enough ithelp will become famous soon enough 
Rep Power: 5
Solved Threads: 67
ithelp ithelp is offline Offline
Posting Shark

Re: SMS(student managent system)

  #7  
May 19th, 2008
I guess you mean
  1. class A {
  2.  
  3. };
  4. class B {
  5. A a;
  6. };
Reply With Quote  
Join Date: Mar 2008
Location: India, Kerala
Posts: 36
Reputation: RenjithVR is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 6
RenjithVR RenjithVR is offline Offline
Light Poster

Re: SMS(student managent system)

  #8  
May 20th, 2008
I think you are thinking about including a file in another file. Write a main function in one file and include the needed header files with that file. Also in each class include the header files they required. The below link will give you a small idea about this.
http://www.eventhelix.com/RealTimeMa...dePatterns.htm

To compile these classes its better to use a Makefile. The following link will guide through how to write and use a Makefile.
http://www.sethi.org/classes/cet375/...mpilation.html
Reply With Quote  
Join Date: Dec 2007
Location: India
Posts: 289
Reputation: Agni is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 38
Sponsor
Agni's Avatar
Agni Agni is offline Offline
Posting Whiz in Training

Re: SMS(student managent system)

  #9  
May 20th, 2008
Are we playing 'Read My Mind' here ...
thanks
-chandra
Reply With Quote  
Join Date: Oct 2006
Location: the Netherlands
Posts: 1,779
Reputation: niek_e is a name known to all niek_e is a name known to all niek_e is a name known to all niek_e is a name known to all niek_e is a name known to all niek_e is a name known to all 
Rep Power: 11
Solved Threads: 185
niek_e's Avatar
niek_e niek_e is offline Offline
Posting Virtuoso

Re: SMS(student managent system)

  #10  
May 20th, 2008
Originally Posted by Agni View Post
Are we playing 'Read My Mind' here ...

In theory, if we supplied ∞ answers, the right one would be among them


So I'll have a look in my crystal ball and say....: Namespaces!

  1. #include <iostream>
  2.  
  3. namespace ClassSpace
  4. {
  5. class a
  6. {
  7. public:
  8. a() { std::cout << "Created A\n";}
  9. ~a(){ }
  10. };
  11. class b
  12. {
  13. public:
  14. b(){ std::cout << "Created B\n";}
  15. ~b(){}
  16. };
  17. }
  18.  
  19. int main()
  20. {
  21. ClassSpace::a Ca;
  22. ClassSpace::b Cb;
  23. std::cin.get();
  24. return 0;
  25. }
Last edited by niek_e : May 20th, 2008 at 3:27 am.
Want better/more replies to your questions? Wrap your code in [code] [/code] tags!
do NOT pm me for help, in the best case, you'll get ignored
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C++ Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the C++ Forum

All times are GMT -4. The time now is 5:34 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC