Hi everyone!
I'm trying to creat a class calling INT, which is equivalent to type int.
I think we must creat every operator for this class like: +, -, *, /, %, pow(x,y),...
I've never seen how does type int look like?
May someone give me a introduction to type int?
Is my idea correct about above operators?
Thanks in advanced!
svatstika
0
Newbie Poster
Recommended Answers
Jump to Post>>I've never seen how does type int look like?
Neither did I. int is a primitive or built-in type. This means you won't find anywhere in the standard libraries an actual definition of int (like "class int { ... }") because the definition of the type is built into the …
Jump to PostI think we must creat every operator for this class like: +, -, *, /, %, pow(x,y),...
Just two would suffice.
struct INT { INT() {} INT( int value ) : builtin_int(value) {} operator int& () { return builtin_int ; } operator int () const { return …
All 7 Replies
mike_2000_17
2,669
21st Century Viking
Team Colleague
Featured Poster
vijayan121
1,152
Posting Virtuoso
learningcpp
8
Newbie Poster
vijayan121
1,152
Posting Virtuoso
svatstika
0
Newbie Poster
embooglement
mrnutty
761
Senior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.