•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 361,561 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,033 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:
Views: 362 | Replies: 11
![]() |
•
•
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 9,872
Reputation:
Rep Power: 31
Solved Threads: 793
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.
This is our time to turn the page on the politics of the past. -- Sen. Barack Obama
If the people cannot trust their government to do the job for which it exists - to protect them and to promote their common welfare - all else is lost.
Barack Obama
If the people cannot trust their government to do the job for which it exists - to protect them and to promote their common welfare - all else is lost.
Barack Obama
•
•
Join Date: Dec 2006
Location: india
Posts: 1,009
Reputation:
Rep Power: 9
Solved Threads: 152
> 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.
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)
#include <boost/mpl/vector.hpp> #include <boost/mpl/push_front.hpp> #include <boost/mpl/push_back.hpp> #include <boost/mpl/replace.hpp> #include <boost/mpl/at.hpp> #include <boost/mpl/int.hpp> #include <boost/mpl/assert.hpp> class A{} ; class B{} ; class C{} ; class D{} ; class E{} ; int main() { using namespace boost ; typedef mpl::vector<A,B> seq_ab ; typedef mpl::push_front< seq_ab, C >::type seq_cab ; typedef mpl::push_back< seq_cab, D >::type seq_cabd ; typedef mpl::replace< seq_cabd, B, E >::type seq_caed ; BOOST_MPL_ASSERT( ( mpl::is_same< mpl::at< seq_caed, mpl::int_<2> >, E > ) ) ; }
•
•
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 9,872
Reputation:
Rep Power: 31
Solved Threads: 793
•
•
•
•
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
};
This is our time to turn the page on the politics of the past. -- Sen. Barack Obama
If the people cannot trust their government to do the job for which it exists - to protect them and to promote their common welfare - all else is lost.
Barack Obama
If the people cannot trust their government to do the job for which it exists - to protect them and to promote their common welfare - all else is lost.
Barack Obama
•
•
Join Date: May 2006
Location: homeworkhelp.co.in
Posts: 790
Reputation:
Rep Power: 4
Solved Threads: 59
I guess you mean
c++ Syntax (Toggle Plain Text)
class A { }; class B { A a; };
cout << Homework Help << Freelance Services << Top 10 Web Host;
cout << Build A Website << Interview Question And Answer << Tax Filing;
cout << Build A Website << Interview Question And Answer << Tax Filing;
•
•
Join Date: Mar 2008
Location: India, Kerala
Posts: 24
Reputation:
Rep Power: 1
Solved Threads: 4
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
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
•
•
Join Date: Oct 2006
Location: the Netherlands
Posts: 1,457
Reputation:
Rep Power: 6
Solved Threads: 148
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)
#include <iostream> namespace ClassSpace { class a { public: a() { std::cout << "Created A\n";} ~a(){ } }; class b { public: b(){ std::cout << "Created B\n";} ~b(){} }; } int main() { ClassSpace::a Ca; ClassSpace::b Cb; std::cin.get(); return 0; }
Last edited by niek_e : May 20th, 2008 at 3:27 am.
"= != =="
PM's asking for help will be ignored..
PM's asking for help will be ignored..
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb C++ Marketplace
•
•
•
•
apple computer engine france gartner google internet job laptop leopard library linux macbook microsoft mobile new year newb news olympics open operating operating system os parliament programmer search sms source student switching system technology texting torvalds upgrade vista wii wiimote windows xp
- Previous Thread: Need help with Connect 4
- Next Thread: Save file

Can you explain me how to link classes with each other? 

Linear Mode