Click here to Skip to main content
15,887,267 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Overwriting in the console Pin
toxcct23-Feb-06 0:25
toxcct23-Feb-06 0:25 
AnswerRe: Overwriting in the console Pin
Cedric Moonen23-Feb-06 0:49
Cedric Moonen23-Feb-06 0:49 
QuestionPrinting directly without dialog box Pin
LapinGarou22-Feb-06 23:53
LapinGarou22-Feb-06 23:53 
AnswerRe: Printing directly without dialog box Pin
Cool Ju23-Feb-06 0:08
Cool Ju23-Feb-06 0:08 
GeneralRe: Printing directly without dialog box Pin
LapinGarou24-Feb-06 22:49
LapinGarou24-Feb-06 22:49 
QuestionHow to get mac address from specical IP? Pin
Rulala22-Feb-06 23:14
Rulala22-Feb-06 23:14 
QuestionPC/SC in C++ Builder Pin
kittymew22-Feb-06 23:07
kittymew22-Feb-06 23:07 
Questionoperator () overloading. Pin
9ine22-Feb-06 23:00
9ine22-Feb-06 23:00 
I'm writing 1D array class and want to overload operator () that is we can retrieve data from class and save it to it

class
{
...
long double *data;
long double &operator(int x)
{
return data[x];
}
...
}

like with this we can simply say
long double a;
a = vec(0);
a += 20;
vec(0) = a;

But how to overload it if I want to use different types of data in array
short *sdata;
float *fdata;
long double *ldata;
and for the overloaded operator always returning/writing to itself long double values casting them to apropriate type (short,float,...)

class vec(short);
long double a;
a = vec(0); //that's easy to always return long double
a += 10;
vec(0) = a; //cast it somehow in overloaded op?

And I dont want to use templates.

9ine
AnswerRe: operator () overloading. Pin
Russell'22-Feb-06 23:22
Russell'22-Feb-06 23:22 
GeneralRe: operator () overloading. Pin
9ine23-Feb-06 1:55
9ine23-Feb-06 1:55 
AnswerRe: operator () overloading. Pin
toxcct22-Feb-06 23:22
toxcct22-Feb-06 23:22 
AnswerRe: operator () overloading. Pin
9ine23-Feb-06 1:03
9ine23-Feb-06 1:03 
GeneralRe: operator () overloading. Pin
9ine23-Feb-06 1:01
9ine23-Feb-06 1:01 
GeneralRe: operator () overloading. Pin
BadKarma23-Feb-06 3:44
BadKarma23-Feb-06 3:44 
GeneralRe: operator () overloading. Pin
9ine23-Feb-06 5:26
9ine23-Feb-06 5:26 
GeneralRe: operator () overloading. Pin
BadKarma23-Feb-06 8:29
BadKarma23-Feb-06 8:29 
QuestionCrystal Reports 11 with visual Studio .NET Pin
Irfan Shahid23-Feb-06 1:04
Irfan Shahid23-Feb-06 1:04 
QuestionRe: operator () overloading. Pin
David Crow23-Feb-06 3:41
David Crow23-Feb-06 3:41 
AnswerRe: operator () overloading. Pin
9ine23-Feb-06 5:18
9ine23-Feb-06 5:18 
GeneralRe: operator () overloading. Pin
David Crow23-Feb-06 5:45
David Crow23-Feb-06 5:45 
GeneralRe: operator () overloading. Pin
9ine23-Feb-06 22:59
9ine23-Feb-06 22:59 
GeneralRe: operator () overloading. Pin
David Crow24-Feb-06 2:42
David Crow24-Feb-06 2:42 
GeneralRe: operator () overloading. Pin
9ine24-Feb-06 3:00
9ine24-Feb-06 3:00 
QuestionRe: operator () overloading. Pin
David Crow24-Feb-06 3:08
David Crow24-Feb-06 3:08 
AnswerRe: operator () overloading. Pin
9ine25-Feb-06 1:08
9ine25-Feb-06 1:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.