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?

Explain comments in c++, Comments Comments are integral part of every p...

Comments Comments are integral part of every program . Comments help in coding, debugging and maintaining a program . The compiler ignores them. They should be used liberally i

Volume, how to find the volume of cone , cylinder and sphere ?

how to find the volume of cone , cylinder and sphere ?

Recursive procedure to computes the number of digits, (a) Write a recursive...

(a) Write a recursive procedure (digits n) that computes the number of digits in the integer n using a linear recursive process. For example, (digits 42) should return 2 and (digit

Net salary, please may i have a brief theory about a c++ program to find ne...

please may i have a brief theory about a c++ program to find net salary of employees

#luminous jewel polishing necklace, Ask question # Byteland county is very ...

Ask question # Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particu

Beginning C++ Through Game Progammin, you are to create a text adventure ga...

you are to create a text adventure game that uses pointers. You have a rich, eccentric Uncle Billy who is soon to be deceased. How soon.....oops......he''s gone. He has left yo

Program Assignment #3, Programming Assignment #3: Vehicle Track Performance...

Programming Assignment #3: Vehicle Track Performance Tests Purpose: The purpose of this programming assignment is to give the student experience in using functions, arrays, and str

C program to find vowels and remove vowels , C Program to FIND VOWELS AND R...

C Program to FIND VOWELS AND REMOVE VOWELS void main() {           char s[100],s1[100];           int i,j,k=0;           clrscr();           printf("ENTER ANY S

Write a program that simulates a simple calculation, The program reads two ...

The program reads two numbers and a character (operator). If the character is "+" then sum is displayed. If it is "-"then difference is displayed. If it is "*" then product is disp

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