Question

Can someone explain these terms to me in C++? Thanks 1. Templates: 2. Function: 3. Template...

Can someone explain these terms to me in C++?

Thanks

1. Templates:
2. Function:
3. Template Instantiation:
4. Overload operators:
5. This pointer:
6. Binary operator:
7. Friend function:
8. Overloading post increment operator:
9. Type:
10. Class Templates:

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1. Templates

Templates are used to do generic programming in c++. it supports working with different data types without rewriting the entire code for each data type. there are function templates and class templates. both of them can work on variety of data type with a single code such as int, double,float..........etc.

2. Function

Function is a set of instructions used for special task. for example to add numbers , sort numbers etc. the same function can be used over and over again. the function can be called at any point of the program after declaration. Generally a function has 3 parts.

  • Function declaration
  • Function definition
  • Function call

3. Template instantiation

The process of creating a function or class from a template declaration is known as template instantiation. The template should be instantiated by providing arguments to it. then only compiler can generate function or class.

4. Overload operators

overload operators are special function with a keyword operator followed by the overloading operator.This function can be used to overload operators . operator overloading is a kind of polymorphism. '+' operator can be overloaded to do addition of two numbers. operators can be overloaded by defining a function to it.

Syntax of operator overloading :  

Return type Class name Operator operator symbol (Argument);

5. This pointer

This pointer is used to refer current object of the executing program.

6. Binary operator

Binary operators are the operators which works on two operands. example, + , - , * etc.

***********************END************PLS GIVE ME UPVOTE************************

Add a comment
Know the answer?
Add Answer to:
Can someone explain these terms to me in C++? Thanks 1. Templates: 2. Function: 3. Template...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • can someone help me create and initialize a pointer to function of DisplayInfo for a template...

    can someone help me create and initialize a pointer to function of DisplayInfo for a template specific data type (double) here is DisplayInfo prototype template <typename ObjType> void DisplayInfo(const ObjType &object)

  • Task: Tasks to complete: ------------------------------------------------------------------------------------------------------------------------------------------ given code: --------------------...

    Task: Tasks to complete: ------------------------------------------------------------------------------------------------------------------------------------------ given code: ------------------------------------------------------------------------------------------------------------------------------------------ main.cpp #include #include "rectangleType.h" using namespace std; // part e int main() { rectangleType rectangle1(10, 5); rectangleType rectangle2(8, 7); rectangleType rectangle3; rectangleType rectangle4; cout << "rectangle1: " << rectangle1 << endl; cout << "rectangle2: " << rectangle2 << endl; rectangle3 = rectangle1 + rectangle2;    cout << "rectangle3: " << rectangle3 << endl; rectangle4 = rectangle1 * rectangle2;    cout << "rectangle4: " << rectangle4 << endl; if (rectangle1 > rectangle2) cout << "Area...

  • C++ myStack.lh stackADT.h Instructions main.cpp 1 #include«iostream» 2 #include<stdlib.h> 3 #include«conio.h> 4 #include«ostream» 5 using namespace std; 6 const int SIZE-5; //Stack size 7 //...

    C++ myStack.lh stackADT.h Instructions main.cpp 1 #include«iostream» 2 #include<stdlib.h> 3 #include«conio.h> 4 #include«ostream» 5 using namespace std; 6 const int SIZE-5; //Stack size 7 //class declaration 8 class stack Instructions Two stacks of the same type are the same if they have the same number of elements and their elements at the corresponding positions are the same Overload the relational operatorfor the class stackType that returns true if two stacks of the same type are the same; it returns false...

  • Please help me out with this assignment. Please read the requirements carefully. And in the main...

    Please help me out with this assignment. Please read the requirements carefully. And in the main function please cout the matrix done by different operations! Thanks a lot! For this homework exercise you will be exploring the implementation of matrix multiplication using C++ There are third party libraries that provide matrix multiplication, but for this homework you will be implementing your own class object and overloading some C+ operators to achieve matrix multiplication. 1. 10pts] Create a custom class called...

  • Can someone help me with these C program problems? Thanks 1. Write a C program that...

    Can someone help me with these C program problems? Thanks 1. Write a C program that creates two arrays of integers, one on the stack and one on the heap. You will loop through these arrays and populate them with values (any value is fine). You will then loop through these arrays again and print each value. Your output should look something like “Value in index 1 is 100 from stack array and 100 from heap array.” Do not forget...

  • Write a code in C++ by considering the following conditions :- Tasks :- 1. Create a...

    Write a code in C++ by considering the following conditions :- Tasks :- 1. Create a class Employee (with member variables: char * name, int id, and double age). 2. Create a constructor that should be able to take arguments and initialize the member variables. 3. Create a copy constructor for employee class to ensure deep copy. 4. Create a destructor and de allocate the dynamic memory. 5. Overload the assignment operator to prevent shallow copy and ensure deep copy....

  • I know the answer is D, but can someone explain to me how to do this...

    I know the answer is D, but can someone explain to me how to do this problem? Thanks. D The following pedigree corresponds to two families that carry a non-threatening autosomal dominant condition. What are the chances of individuals 11-3 and 11-4 to have a child with the genetic condition? A. 3/4 B. 1/6 C. 5/6 D. 8/9 E. 4/36 ?

  • This Program should run in C++ In an effort to develop in-depth knowledge of base class, derived class, and operator overloading, we will expand on our in-class exercise of developing the rectangleTyp...

    This Program should run in C++ In an effort to develop in-depth knowledge of base class, derived class, and operator overloading, we will expand on our in-class exercise of developing the rectangleType class and overload the following operators: +, -, *, ++, --, ==, !=, >>, and <<. Your program should contain the following features: a. Create a base class named rectangleType with following private data members: • length with double type • width with double type b. rectangleType class...

  • Can someone help me in java Net Beans IDE witht the code andjava comments. Thanks...

    Can someone help me in java Net Beans IDE witht the code and java comments. ThanksMany of these classes will just need to be copied from previous assignments. When you implement the Tree interface you may import the java.util.Iterator class. When you implement the AbstractBinaryTree class you may import the java.util.ArrayList class and the java.util.List class.In this project you will be doing the following:Create a NetBeans project named lab07 and ensure it is imported into your SVN.In this lab assignment...

  • NEED ASAP PLEASE HELP Task: --------------------------------------------------------------------------------------...

    NEED ASAP PLEASE HELP Task: --------------------------------------------------------------------------------------------------------------------------------- Tasks to complete: ---------------------------------------------------------------------------------------------------------------------------------------- given code: ----------------------------------------------------------------------------------------------------------------------------------------------- main.cpp #include <iostream> #include <iomanip> #include "fractionType.h" using namespace std; int main() { fractionType num1(5, 6); fractionType num2; fractionType num3; cout << fixed; cout << showpoint; cout << setprecision(2); cout << "Num1 = " << num1 << endl; cout << "Num2 = " << num2 << endl; cout << "Enter the fraction in the form a / b: "; cin >> num2; cout << endl; cout <<...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT