943,513 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 1310
  • C++ RSS
You are currently viewing page 1 of this multi-page discussion thread
May 12th, 2008
0

SMS(student managent system)

Expand Post »
Can you explain me how to link classes with each other?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
WondererAbu is offline Offline
4 posts
since Apr 2008
May 12th, 2008
0

Re: SMS(student managent system)

... dude.... what do you mean by 'link classes' ?
Featured Poster
Reputation Points: 431
Solved Threads: 116
Practically a Master Poster
Agni is offline Offline
654 posts
since Dec 2007
May 12th, 2008
0

Re: SMS(student managent system)

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.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,945 posts
since Aug 2005
May 12th, 2008
0

Re: SMS(student managent system)

> 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.
c++ Syntax (Toggle Plain Text)
  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. }
Reputation Points: 1159
Solved Threads: 285
Posting Virtuoso
vijayan121 is offline Offline
1,606 posts
since Dec 2006
May 19th, 2008
0

Re: SMS(student managent system)

Click to Expand / Collapse  Quote originally posted by Agni ...
... 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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
WondererAbu is offline Offline
4 posts
since Apr 2008
May 19th, 2008
0

Re: SMS(student managent system)

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?
C++ Syntax (Toggle Plain Text)
  1. class base
  2. {
  3. // blabla
  4. };
  5.  
  6. class derived : public base
  7. {
  8. // linked (derived) class
  9. };
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,945 posts
since Aug 2005
May 19th, 2008
0

Re: SMS(student managent system)

I guess you mean
c++ Syntax (Toggle Plain Text)
  1. class A {
  2.  
  3. };
  4. class B {
  5. A a;
  6. };
Reputation Points: 769
Solved Threads: 128
Banned
ithelp is offline Offline
1,910 posts
since May 2006
May 20th, 2008
0

Re: SMS(student managent system)

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
Reputation Points: 12
Solved Threads: 7
Light Poster
RenjithVR is offline Offline
41 posts
since Mar 2008
May 20th, 2008
0

Re: SMS(student managent system)

Are we playing 'Read My Mind' here ...
Featured Poster
Reputation Points: 431
Solved Threads: 116
Practically a Master Poster
Agni is offline Offline
654 posts
since Dec 2007
May 20th, 2008
0

Re: SMS(student managent system)

Click to Expand / Collapse  Quote originally posted by Agni ...
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!

cpp Syntax (Toggle Plain Text)
  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 Nick Evan; May 20th, 2008 at 4:27 am.
Moderator
Featured Poster
Reputation Points: 4142
Solved Threads: 394
Industrious Poster
Nick Evan is offline Offline
4,132 posts
since Oct 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Need help with Connect 4
Next Thread in C++ Forum Timeline: Save file





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC