Library of Classes

Pages: 12345... 7
OK, so when can we code??? when can we code???
@ OP: I know you're excited but these details matter. I'm sorry for sort of highjacking your thread but this is too interesting to just let go of.

@ webJose: I see where you're coming from now, but to me when you say "Compound Unit" like kilometers per hour I think "that's a unit of speed and should be it's own object type".
who's OP
OP = Origional Poster, that's you chief.
Ok, for real here's my idea:
1
2
3
4
5
6
7
8
9
10
11
12
#include <cstdlib>
#include <iostream>

class MeasUnit
{
   public:
      double Gcf=0 ;
} unit_std ;
typedef int unit_std.Gcf ;
unit_std.Gcf meter=1.0 ;
unit_std.Gcf kilometer=1000.0 ;
//etc. 

that should polish up the conversion factors
Last edited on
You've completely lost me now, does that even compile? I mean even if you add the entry point the datatype 'int' doesn't have a member named "Gcf".
sorry it should have said
 
typedef double unit_std.Gcf ;

Last edited on
I don't really see why not with it double not int...
You don't use typedef when you you declare an object of a class...
Because it makes unit_std.Gcf a new type. So we define kilometer, meter, etc. as a unit_std.Gcf type, that's all.
Why not, there's no differnece just has something.somethinginclass
Well how about
1
2
3
4
double GCF=unit_std.Gcf ;
typedef double GCF ;
GCF meter=1.0 ;
GCF kilometer=1000.0 ;

Better?
So now it would say:
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <cstdlib>
#include <iostream>

class MeasUnit
{
   public:
      double Gcf=0 ;
} unit_std ;
double GCF=unit_std.Gcf ;
typedef double GCF ;
GCF meter=1.0 ;
GCF kilometer=1000.0 ;
//etc.  
Last edited on
Just do me a favor and try to compile what you've written so far.
But maybe we should conceal that into a template for organization purposes?
^You don't seem to understand what a template does.
Comes up error on line 7 above.
@ firedraco I think I do.
Yup, Line 7, 9, 10, 11 and 12. I think you need to slow down for a minute, like firedraco said you seem to be confused about some of these topics.
So please don't bug me. Thnx.
Pages: 12345... 7