Question

Which of the following are ways to declare a new data type in C++? more than...

Which of the following are ways to declare a new data type in C++?

more than 1 choice is accepted

A.

There is no need to declare the data type in C++

B.

Using the new keyword

C.

Create an alias using typedef

D.

Create a new type by using class or struct.

E.

Create an extension of an existing type using inheritance.

F.

Using the auto keyword

QUESTION 6

  1. When an object is copied by assigning each of the destination data members equal to the source data members, it is called what?

    A.

    Deep-Copy

    B.

    Copy Constructor

    C.

    Shallow-Copy

    D.

    Copy-Assignment operator

QUESTION 7

  1. Given the following partially defined class, what other special function members should be defined?

    class Collection  {  public:   // ...   ~Collection()   {    delete [] Data;   }   // ...  private:   int* Data;  };
    A.

    Copy Constructor

    B.

    Copy-Assignment Operator

    C.

    Comparison Operators

    D.

    Default Constructor

    E.

    Sorting Functions

  

QUESTION 8

  1. Generic programming using patterns for similar classes involves what C++ language feature?

    A.

    Standard Functions

    B.

    Lambda Functions

    C.

    Class Templates

    D.

    Function Templates

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

1)
C)  Create an alias using typedef
D)  Create a new type by using class or struct.
E)  Create an extension of an existing type using inheritance.

6)
C)  Shallow-Copy

7)
A)  Copy Constructor

8)
C)  Class Templates
Add a comment
Know the answer?
Add Answer to:
Which of the following are ways to declare a new data type in C++? more than...
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
  • please write the code in C++ 2 Base class File 3 Derived class PDF 3.1 Class...

    please write the code in C++ 2 Base class File 3 Derived class PDF 3.1 Class declaration • The class PDF inherits from File and is a non-abstract class 1. Hence objects of the class PDF can be instantiated. 2. To do so, we must override the pure virtual function clone) in the base class • The class declaration is given below. • The complete class declaration is given below, copy and paste it into your file. . It is...

  • Declare a Person class having two data members, Name of type string, and DOB (date of...

    Declare a Person class having two data members, Name of type string, and DOB (date of birth) of type Date. Assume that the Date class has already been written for you and you can use it by including the header file. Declare and define an appropriate constructor, and the functions setName, setDOB, getName and getDOB for this class. You need to write the complete code for declaring and defining this Person class with the given specifications.

  • The designer of a class C mentions to you that he needs to add a default...

    The designer of a class C mentions to you that he needs to add a default constructor to C. Which of the following is almost certainly true? C has const data members The designer should write his own destructor for C C has const member functions It is not currently possible to declare an array of C The designer should write his own assignment operator for C. It is not currently possible to declare any variables of type C. Which...

  • 5. A complex number consists of two components: the real component and the imaginary component. A...

    C++ //add as many comments as possible 5. A complex number consists of two components: the real component and the imaginary component. An example of a complex number is 2+3i, where 2 is the real component and 3 is the imaginary component of the data. Define a class MyComplexClass. It has two data values of float type: real and imaginary This class has the following member functions A default constructor that assigns 0.0 to both its real and imaginary data...

  • please write in c++. 4 Derived class JPG 4.1 Class declaration • The class JPG inherits...

    please write in c++. 4 Derived class JPG 4.1 Class declaration • The class JPG inherits from File and is a non-abstract class. 1. Hence objects of the class JPG can be instantiated. 2. To do so, we must override the pure virtual function clone() in the base class. • The class declaration is given below. class JPG : public File { public: JPG(const std::string& n, int n, int w, const double rgb()) : File(...) { // ... } *JPG()...

  • 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....

  • 2. (50 marks) A string in C++ is simply an array of characters with the null...

    2. (50 marks) A string in C++ is simply an array of characters with the null character(\0) used to mark the end of the string. C++ provides a set of string handling function in <string.h> as well as I/O functions in <iostream>. With the addition of the STL (Standard Template Library), C++ now provides a string class. But for this assignment, you are to develop your own string class. This will give you a chance to develop and work with...

  • C++ program Create a class Time having data members HH, MM, SS of type integer. Write...

    C++ program Create a class Time having data members HH, MM, SS of type integer. Write a C++ program to do the following: 1. Use a Constructor to initialize HH, MM, SS to 0. 2. Create two Objects of this class and read the values of HH, MM, SS from the user for both objects (Using proper member functions). 3. Use a binary + operator to add these two objects created (Store & display result using separate object). 4. Use...

  • C++ More Classes PRE-LAB WRITING ASSIGNMENT Fill-in-the-Blank Questions C++ introduces two new uses for the static...

    C++ More Classes PRE-LAB WRITING ASSIGNMENT Fill-in-the-Blank Questions C++ introduces two new uses for the static keyword when applied to classes: _________________ variables, and _________________. It is better to think of static members as belonging to the _________________ itself. Because static member variables are not part of the individual objects, you must explicitly define the __________________ if you want to initialize it to a non-zero value. List an important use of static member variables_______________________________________. A __________________ is a function that...

  • Overload a relational operator for the Job class: Assume that this operator is not overloaded for...

    Overload a relational operator for the Job class: Assume that this operator is not overloaded for the Salary class. a) Write how the function will be declared in your code. b) Write an external function definition (not inside the class). solve it in C++10 to solve this you nedd question number 1. Create a composition between the classes Job and Salary. Class Salary a. data member:    1. money b. constructors:    1. default constructor    2. user defined constructor with a parameter...

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