Can one create operator** for "to-the-power-of" operations?, C/C++ Programming

Assignment Help:

A: no, can't.

The names of, precedence of, associativity of, and arity of operators is fixed through the language. In C++, there is no operator** so you cannot create one for a class type.

If you have a doubt, assume that x ** y is the same as x * (*y) (in other terms, the compiler suppose y is a pointer). As well, operator overloading is only syntactic sugar for function calls. Although this specific syntactic sugar can be very sweet, it doesn't add anything fundamental. I recommend you overload pow (base,exponent) (double precision version is in ).

By the way, operator^ can work for to-the-power-of, except it contain the wrong associatively and precedence.

 

 


Related Discussions:- Can one create operator** for "to-the-power-of" operations?

Described local class? why can it be useful?, It is a class defined in the ...

It is a class defined in the scope of a function _ any function, whether a member functions or a free function. For instance: // Example : Local class // int f() { c

We need to decompile ex4 to mq4, We need to Decompile ex4 to mq4 I have ...

We need to Decompile ex4 to mq4 I have three expert advisors for mt4, which I need to decompile to its original mq4 code. Skills required are C Programming, C++ Programming,

Oop, what is oop?

what is oop?

Explain relational operators, Relational Operators A relational operato...

Relational Operators A relational operator is used to make comparison among two values. All these operators are binary and needs two operands. There are the following relationa

C program to check even & odd no, C Program to Check  EVEN & ODD NO   ...

C Program to Check  EVEN & ODD NO   main() {           int n, a;           clrscr();           printf("ENTER ANY NUMBER: ");           scanf("%d", &n);

Write a haskell program, Write a Haskell program that calculates a balanced...

Write a Haskell program that calculates a balanced partition of N items where each item has a value between 0 and K such that the difference between the sum of the values of first

C program to design text styles, Program to design text styles: Write ...

Program to design text styles: Write a C program to design different text style char *fname[] = { "DEFAULT font",                                   "TRIPLEX font",

Define the return statement in computer programming, Define The Return Stat...

Define The Return Statement in Computer Programming? The return statement is used for two purposes once the return statement is executed the program control will be immediately

Class, array of class objects and single inheritance

array of class objects and single inheritance

Padovan string, A Padovan string P(n) for a natural number n is defined as:...

A Padovan string P(n) for a natural number n is defined as: P(0) = ‘X’ P(1) = ‘Y’ P(2) = ‘Z’ P(n) = P(n-2) + P(n-3), n>2 where + denotes string concatenation. For a string of t

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd