 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Mel Guest
|
Posted: Mon Nov 28, 2005 9:07 pm Post subject: overloading constructor & destructors ? insane :-) |
|
|
i need to have access to all objects, their variables and possibly
methods of same classes.In other words, i would like to be able to
manipulate my objects via an external interface to my application.
for this i will have a simple client portion written and compiled into
my application. this will connect to my server that is ready for
interrogation from command line.
question: do i have to mess with contructor/destructor to do that ? any
code sample is highly appreciated.
thanks in advance.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Ron Natalie Guest
|
Posted: Tue Nov 29, 2005 10:25 am Post subject: Re: overloading constructor & destructors ? insane :-) |
|
|
Mel wrote:
| Quote: | i need to have access to all objects, their variables and possibly
methods of same classes.In other words, i would like to be able to
manipulate my objects via an external interface to my application.
for this i will have a simple client portion written and compiled into
my application. this will connect to my server that is ready for
interrogation from command line.
question: do i have to mess with contructor/destructor to do that ? any
code sample is highly appreciated.
You can't overload destructors. They only come one way no arguments. |
It's not going to be easy to do what you want to do without:
1. Pervasive changes to all the classes in your program.
2. Use of some "external to C++" interface such as your system's
debugging interface.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Ulrich Eckhardt Guest
|
Posted: Tue Nov 29, 2005 1:58 pm Post subject: Re: overloading constructor & destructors ? insane :-) |
|
|
Mel wrote:
| Quote: | i need to have access to all objects, their variables and possibly
methods of same classes.In other words, i would like to be able to
manipulate my objects via an external interface to my application.
for this i will have a simple client portion written and compiled into
my application. this will connect to my server that is ready for
interrogation from command line.
question: do i have to mess with contructor/destructor to do that ? any
code sample is highly appreciated.
|
You never _need_ to mess with ctor/dtor, but I seriously wonder how you plan
to write a program in C++ if these present any difficulty to you. In
particular since you want to track objects, the best place to start doing
so is their ctors and dtor though, so I suggest you go that way.
What isn't clear from your posting is what you really want. Just for your
info, C++ doesn't supply a means to access info about each and every object
that is created - after all, what about the objects used to track these? It
would require infinite recursion. Other than that, it would require an
unnecessary overhead for those that don't need it. It is also not necessary
to support e.g. garbage collection because C++ doesn't have builtin GC like
e.g. Python has.
Uli
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Michiel.Salters@tomtom.co Guest
|
Posted: Tue Nov 29, 2005 3:55 pm Post subject: Re: overloading constructor & destructors ? insane :-) |
|
|
Mel wrote:
| Quote: | i need to have access to all objects, their variables and possibly
methods of same classes.In other words, i would like to be able to
manipulate my objects via an external interface to my application.
for this i will have a simple client portion written and compiled into
my application. this will connect to my server that is ready for
interrogation from command line.
question: do i have to mess with contructor/destructor to do that ? any
code sample is highly appreciated.
thanks in advance.
|
Tricky. Ints are objects, too, and they really don't have constructors.
Furthermore, quite a lot of them are really elusive, e.g. being in
registers or just temporaries on the stack.
Now, if you have a few user-defined classes that you want to manipulate,
things would be a loat easier. In that case, an extra (virtual) base
class gives you quite a lot. Bases are created first and destroyed last.
HTH,
Michiel Salters
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
gerg Guest
|
Posted: Wed Nov 30, 2005 1:49 am Post subject: Re: overloading constructor & destructors ? insane :-) |
|
|
you could inheret from IDispatch if you don't mind using COM. You then
can use the many COM "container" apps out there to manipulate the
object for testing purposes. You could also run the classes remotely
without too much more effort.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|