What is function overloading and operator overloading?

1 Answer

Answer :

Function overloading: C++ enables several functions of the same name to be defined, as  long as these functions have different sets of parameters (at least as far as their types are  concerned). This capability is called function overloading. When an overloaded function is  called, the C++ compiler selects the proper function by examining the number, types and
order of the arguments in the call. Function overloading is commonly used to create  several functions of the same name that perform similar tasks but on different data types.  Operator overloading allows existing C++ operators to be redefined so that they work on  objects of user-defined classes. Overloaded operators are syntactic sugar for equivalent  function calls. They form a pleasant facade that doesn't add anything fundamental to the  language (but they can improve understandability and reduce maintenance costs).

Related questions

Description : State True or False. i) While overloading operators new operator can be overloaded. ii) The binary operator such as +, -, * and must explicitly return a value. A) True, True B) True, False C) False, True D) False, False

Last Answer : C) False, True

Description : Write a program for overloading of ++unary operator for inch to feet conversion. 12 inch = 1 feet.

Last Answer : #include #include class abc { int i,f; public: abc(int f1,int i1) { f=f1; i=i1; } void operator ++() {  while(i>11)  {  f++;  i=i-12;  }  cout

Description : Use the concept of operator overloading to overload unary ‘-‘ operator to negate value of variables.

Last Answer : # include <iostream.h> #include<conio.h> class unary { int x, y, z; public: void getdata (int a, int , int c); void display (void); void operator - (); // overload unary minus. }; ... u. display ( ) ; -u; cout<< " u : " ; u. display ( ) ; }

Description : State any four rules for operator overloading.

Last Answer : Rules for operator overloading: 1. Only existing operators can be overloaded. New operators cannot be created. 2. The overloaded operator must have at least one operand that is of user defined type. 3. ... * and / must explicitly return a value. They must not attempt to change their own arguments. 

Description : Overlay is: a) A part of an operating system b) A single contiguous memory that is used in olden days for running large programs by swapping c) Overloading the system with many user files d) None of The Above

Last Answer : b) A single contiguous memory that is used in olden days for running large programs by swapping

Description : An attacker can create an …………………………….. attack by sending hundreds or thousands of emails with very large attachment A)Attachment Overloading Attack B)Connection Attack C)Auto Responder Attack D)All of the Above

Last Answer : A)Attachment Overloading Attack

Description : An attackers can create an …....attack by sending hundreds or thousand of e-mail with very large attachment. a. Connection Attack b. Auto responder Attack c. Attachment overloading Attack d. All of the above

Last Answer : c. Attachment overloading Attack

Description : an attack can create and attack by sending hundreds or thousand of e-mail with very large attachment (a) connection attack (b) auto responder attack (c) attachment overloading attack (d) all of the above

Last Answer : (c) attachment overloading attack

Description : An attacker can create an________attack by sending hundreds or thousands of e-mails a with very large attachments. A. Connection Attack B. Auto responder Attack C. Attachment Overloading Attack D. All the above

Last Answer : B. Auto responder Attack

Description : An attacker can create an …………………………….. attack by sending hundreds or thousands of emails with very large attachment A)Attachment Overloading Attack B)Connection Attack C)Auto Responder Attack D)All of the Above

Last Answer : A)Attachment Overloading Attack

Description : When would you use function overloading over default argument?

Last Answer : Default arguments are often considered to be optional arguments,however a default argument is only optional in the sense that thecaller need not provide a value for it. The function must ... overload tocall, resulting in code duplication that would likely be besthandled by the function itself.

Description : The function of fuse in an electrical circuit is (a) avoid electric shocks (b) regulate the flow of current (c) break the circuit in case of overloading or short circuiting (d) switch off current

Last Answer : Ans:(c)

Description : What is the difference between function overloading and function overriding?

Last Answer : A: In function overloading only the function name is same but function signature (list of parameters) is different, whereas, in function overriding both the function name as well as function ... is an example of static polymorphism, whereas, function overriding is an example of dynamic polymorphism.

Description : Which of the following is true about Java. A) Java does not support overloading. B) Java has replaced the destructor function of C++ C) There are no header files in Java. D) All of the above.

Last Answer : D) All of the above

Description : Write a C++ program to swap two integer numbers and swap two float numbers using function overloading.

Last Answer : #include<iostream.h> #include<conio.h> void swap(int a,int b) { int temp; temp=a;  a=b;  b=temp; cout<<"\nInteger values after swapping are:"<<a<<" "< ... { clrscr(); swap(10,20); swap(10.15f,20.25f); getch(); }

Description : Polymorphism is implemented using function overloading. Justify the statement.

Last Answer : Polymorphism is a mechanism that allows a developer to have more than one function with same name but different signature. In function overloading, one can make use of more than one function with different signature as well. Hence ... main()  { int a[10],i,isum; float b[5],fsum; clrscr(); cout

Description : Write a program to calculate area of circle and area of rectangle using function overloading. 

Last Answer : #include<iostream.h> #include<conio.h> float area(float a) { return (3.14*a*a); } int area(int p,int q) { return(p*q); } void main() { clrscr(); cout< ... ;<<area(6); cout<<"Area of Rectangle:"<<area(5,6); getch(); }

Description : Which of the following differentiates between overloaded functions and overridden functions ? (A) Overloading is a dynamic or runtime binding and overridden is a static or compile time binding. ... function overloading, while redefining a function in a friend class is called function overriding.

Last Answer : (B) Overloading is a static or compile time binding and overriding is dynamic or runtime binding.

Description : Looking for video of an air guage overloading?

Last Answer : answer:http://www.youtube.com/watch?v=HE6zLzRQbUU This may not be exactly what you’re looking for but I believe I’ve started you in the right direction! youtube has a ton of videos, surly one of them will work for your needs!

Description : 3. What precaution should be taken to avoid the overloading of domestic electric circuits? -Physics-10

Last Answer : A few of the precautions to be taken to avoid the overloading of domestic electric circuits are as follows: Connecting too many devices to a single socket should be avoided Using too many appliances at the same time should be avoided Faulty appliances should not be connected to the circuit

Description : Coast Guard Regulations (46 CFR), require that an indicating light at the propulsion control station will operate if overloading or overheating occurs in a _______________. A. forced draft blower motor B. steering gear motor C. fuel pump motor D. condensate pump motor

Last Answer : Answer: B

Description : If overloading a DC machine becomes necessary in an emergency, you should ____________. A. cool the machine with portable blowers and fans B. hold thermal overload relays open with blocks of ... the windings for cooling D. increase the residual magnetism value of windings to reduce eddy currents

Last Answer : Answer: A

Description : What is Overloading of procedures ?

Last Answer : The Same procedure name is repeated with parameters of different datatypes and parameters in different positions, varying number of parameters is called overloading of procedures. e.g. DBMS_OUTPUT put_line

Description : The process of assigning PCM codes to absolute magnitudes A. Overloading B. All of these C. Quantizing D. Multiplexing

Last Answer : C. Quantizing

Description : What is a Method Overloading?

Last Answer : Method with same name but with different arguments is called method overloading

Description : What is method overloading, and when is it useful?

Last Answer : Method overloading allows you to create several methods with the same name but different signatures. Overloading is useful when you want to provide the same or similar functionality to different sets of parameters.

Description : How is method overriding different from method overloading? 

Last Answer : When overriding a method, you change the behavior of the method for the derived class. Overloading a method simply involves having another method with the same name within the class.

Description : How is method overriding different from method overloading? 

Last Answer : When overriding a method, you change the behavior of the method for the derived class. Overloading a method simply involves having another method with the same name within the class.

Description : How’s method overriding different from overloading?

Last Answer : When overriding, you change the method behavior for a derived class. Overloading simply involves having a method with the same name within the class.

Description : What is OVERLOADING ?

Last Answer : OVERLOADING:  Large amount of current will flow beyond the permissible value of current.  This causes the fire.  At the same time, many appliances are switched ON, overloading is happened.  Overloading can be avoided by not connecting many appliances at same time.

Description : Smoke is produced due to (A) Insufficient supply of combustion air and insufficient time for combustion (B) Poor quality of fuel and improper mixing of fuel & combustion air (C) Poor design & overloading of furnace (D) All (A), (B) and (C)

Last Answer : (D) All (A), (B) and (C)

Description : Define what is meant by method overloading?

Last Answer : Method overloading permits multiple methods in the same class to have the same name as long as they have unique signatures. When compiling an invocation of an overloaded method, the compiler uses overload resolution to determine the specific method to invoke.

Description : Difference between Overloading and Overriding ?

Last Answer : Ans. Overloading - Similar Signature but different definition , like function overloading. Overriding - Overriding the Definition of base class in the derived class

Description : Heavy smoking in an engine in operation may be due to 1. Overloading 2. Mixtures 3. Late injection 4. all of these

Last Answer : ans 4

Description : Companding helps in reducing __________ with respect to signal: (A) Interference (B) Signal overloading (C) Non linearity (D) Quantization noise

Last Answer : (D) Quantization noise

Description : Does PL/SQL support “overloading”? Explain

Last Answer : The concept of overloading in PL/SQL relates to the idea that you can define procedures and functions with the same name. PL/SQL does not look only at the referenced name, however, ... Prefacing a procedure or function name with the package name fully qualifies any procedure or function reference.

Description : …………. Is the process of creating new classes, called derived classes from existing classes called base class. A) Inheritance B) Encapsulation C) Polymorphism D) Overloading

Last Answer : A) Inheritance

Description : ………… enable us to hide, inside the object, both the data fields and the methods that act on that data. A) Encapsulation B) Polymorphism C) Inheritance D) Overloading

Last Answer : A) Encapsulation

Description : An attacker can create an _____attack by sending hundreds or thousands of email with very large attachments a) Connection Attacks b) Auto responder attacks c) Attachment Overloading Attacks d) All of the above

Last Answer : c) Attachment Overloading Attacks

Description : Differentiate between method overloading and method overriding.

Last Answer : Sr. No. Method overloading Method overriding 1 Overloading occurs when two or more methods in one class have the same method name but different parameters. Overriding means having two ... 4 overloading is a compiletime concept. Overriding is a run-time concept

Description : Close inspection of a failed metal part reveals artifacts on the fracture surface commonly referred to as "striations" or "beach marks". This indicates the component failed as a result of: w) Sudden overloading x) Cyclical loading y) Stress corrosion cracking z) None of the above

Last Answer : ANSWER: X -- CYCLICAL LOADING

Description : Which of the following correctly describes overloading of functions? (A) Virtual polymorphism (B) Transient polymorphism (C) Ad-hoc polymorphism (D) Pseudo polymorphism

Last Answer : (C) Ad-hoc polymorphism

Description : .................. allows to create classes which are derived from other classes, so that they automatically include some of its "parent's" members, plus its own members. (A) Overloading (B) Inheritance (C) Polymorphism (D) Encapsulation 

Last Answer : (B) Inheritance

Description : Personnel who design, program, operates and maintains computer equipment refers to A) Console-operator B) Programmer C) Peopleware D) System Analyst

Last Answer : Answer : C

Description : What is the name of the display feature that highlights are of the screen which requires operator attention? A) Pixel B) Reverse video C) Touch screen D) Cursor

Last Answer : Answer : B

Description : The work done by a computer operator is displayed in which part of computer? A. CPU B. VDU C. ALU D. None of the Above

Last Answer : B. VDU

Description : What does the && operator do in a program code?

Last Answer : The && is also referred to as AND operator. When using this operator, all conditions specified must be TRUE before the next action can be performed. If you have 10 conditions and all but 1 fails to evaluate as TRUE, the entire condition statement is already evaluated as FALSE.

Description : What is the modulus operator?

Last Answer : The modulus operator outputs the remainder of a division. It makes use of the percentage (%) symbol. For example: 10 % 3 = 1, meaning when you divide 10 by 3, the remainder is 1.

Description : The basic operation performed by a computer are: a) Arithmatic Operator b) Logical c) Storation d) All of above e) None of These

Last Answer : d) All of above