sorry, I recognize my example lacked on specifics. here is an adaptation of your code to what I am looking for:
#include <iostream>
class base
{
friend std::ostream &...
Type: Posts; User: killme
sorry, I recognize my example lacked on specifics. here is an adaptation of your code to what I am looking for:
#include <iostream>
class base
{
friend std::ostream &...
ok, so I worked arround the problem like this:
class base{
friend std::istream & operator>>(std::istream & in, base & v);
public:
virtual void readtest();
base();
};
S I want to have different >> operators for several derived classes. Has I tested...
class base{
friend std::istream & operator>>(std::istream & in, base & v);
public:
base();
};
...
Ok, thank you both. I had not realised I could pointers to the base function on the derived ones when I was reading about it. Here is my test code (feel free to suggest different approaches):
...
hi, I'm developing a numerical tool and wanted to figure out a way to restructure some of my code. So here is what I want to do:
I want to create several (sub-)classes (model_1,model_2,...) that...
yes, I understand. but for now I'm chosing to avoid the problem rather than figure out exactly what it is (any bets on how thats gonna come back to bite me in the ass a couple of weeks from now?).
for some reason my simpler example works fine.
but I managed to work arround the problem without having the map static so I wont bother people anymore with this.
thanks for the help
ok, so I finished building most member functions of my class and when It came arrond to testing I ended up with a memory leak.
a bit of messing about and I found out the program runs as intended...
yey, it works. thanks for the help.
just to make sure I'm clear about order of operations (I'm probably not), this line...
pp[1]=particle_properties(.32,1);
...translates into:
1- create an...
oh, I've done that. or rather I've done correctly for pp and then when it didn't work and I created the "testmap" I forgot it (adding non-relevant 1 error line to the flaglist that I obviously chose...
hey,
I'm not sure what I'm doing wrong here and why is my code not compiling. I'm also not sure if there is a better aproach then mine and I'm always open to sugestions.
so I'm trying to create a...
thanks every1,
up until now I've been trying to keep the project I'm working on C++98 compatible but, seeing that C++11 is by far the best option here, I might opt for it.
Now I just have to...
I just compiled some code I've been working on at a different OS/compiler and realised that
sizeof(unsigned long)
returns 4 in one pc and 8 in another.
I've heard that bytesize conventions for...
Someone said to me once that when possible I should use static functions because it helps the compiler "in-line operations" (which I admittedly have no idea of the meaning). I was looking for...
what Salem mean is that on line 43 you have
myClass(thename);
myClass is not an object. If you want to use a class constructor, you should actually "construct something".
having that said,...
I'm still pretty unexperienced with object oriented programing but I'm taking a look at inheritance in C++ Primer and I'll see what I can do. Thanks for the help
thaks for the help
I actually need the function to change operations after the object is declared...i.e.:
the object is declared... the function does one thing every time its called until the...
hey,
I´ve been trying to use pointers to functions to alter the effect of a class function and I've apparently been using the syntax incorrectly. I've tried a few different ways and check one ref...
using C++11 isn't really an option (not that I don't have a compiler for it, its just a project requirement)
this doesn't have the need to allocate temporary memory every time its called?
hey
do I have a way to push_back a data sctructure into a vector without an outside copy? I mean: can I initialize the constructor of a class directly on vector im storing it?
avoiding doing...
well, right now you are initializing your storage like this:
char storeCharacters[] = {0};
what size do you expect that array to be?
program is intended for linux, it requires a library (LHAPDF) that currently has no way of being installed on PC (well, at least not an easy one) and the idea is for the source code to be released so...
this sounds silly but my only consideration should be class data right?
I mean, my class will have roughly 10 simple variables and a couple of arrays inside. the amount of member functions I put...
one of my project requeriments is to stay out of C++11 for portability considerations (not really my choice). So reserve(), I'll look it up. thank you all
thats exacly the oposite of what thought. thanks, I would pointlessly go the wrong way about this.
I thought of that, the class will be used in more than one calculation, and in at least one...