answersLogoWhite

0

#include<iostream>

class foo{

int m_data;

};

int main()

{

foo* p=new foo;

delete( foo), foo=NULL;

return(0);

}

User Avatar

Wiki User

12y ago

What else can I help you with?

Continue Learning about Engineering

Write a program to find the grade obtained by the students of a class using structure?

Write a program to find the grade obtained by the students of a class


When the Java Virtual Machine sees the new operator in a program it instantiates an object for a specified class.?

Yes.


What is the difference between destructors and delete?

Delete is a built-in operator used forcibly release a dynamically allocated resource. Delete can only be used on pointer types, including pointer arrays. A destructor is a class method used to clean up any resources acquired by objects of the class. Destructors are invoked automatically from the most-derived class to the least-derived class, as soon as an object falls from scope. When you delete a pointer to an object, the object's destructor sequence is invoked. Note that you must not delete named objects otherwise you end up with a null reference. References must never be null.


Which class methods does the compiler generate automatically if you don't provide them explicitly?

Default constructor: X()Copy constructor: X(const X&)Copy assignment operator: X& operator=(const X&)Move constructor: X(X&&)Move assignment operator: X& operator=(XX&)Destructor: ~X()By default, the compiler will generate each of these operations if a program uses it. However, if the programmer declares any constructor for a class, the default constructor for that class is not generated. If the programmer declares a copy or move operation, no copy, move or destructor is generated. If the programmer declares a destructor, no move operation is generated (a copy constructor is generated for backward compatibility).We can also suppress generation of specific operations with the =delete pseudo-initialiser:class X {public:X (const X&) =delete; // suppress the compiler-generated copy operationsX& operator=(const X&) =delete;// ...};


How do you write a binomial distribution table in C program?

Class&amp;genus

Related Questions

Write a program to find the grade obtained by the students of a class using structure?

Write a program to find the grade obtained by the students of a class


When the Java Virtual Machine sees the new operator in a program it instantiates an object for a specified class.?

Yes.


What is the difference between destructors and delete?

Delete is a built-in operator used forcibly release a dynamically allocated resource. Delete can only be used on pointer types, including pointer arrays. A destructor is a class method used to clean up any resources acquired by objects of the class. Destructors are invoked automatically from the most-derived class to the least-derived class, as soon as an object falls from scope. When you delete a pointer to an object, the object's destructor sequence is invoked. Note that you must not delete named objects otherwise you end up with a null reference. References must never be null.


Which class methods does the compiler generate automatically if you don't provide them explicitly?

Default constructor: X()Copy constructor: X(const X&)Copy assignment operator: X& operator=(const X&)Move constructor: X(X&&)Move assignment operator: X& operator=(XX&)Destructor: ~X()By default, the compiler will generate each of these operations if a program uses it. However, if the programmer declares any constructor for a class, the default constructor for that class is not generated. If the programmer declares a copy or move operation, no copy, move or destructor is generated. If the programmer declares a destructor, no move operation is generated (a copy constructor is generated for backward compatibility).We can also suppress generation of specific operations with the =delete pseudo-initialiser:class X {public:X (const X&) =delete; // suppress the compiler-generated copy operationsX& operator=(const X&) =delete;// ...};


How do you write a binomial distribution table in C program?

Class&amp;genus


Write a program to display the name of days when a user enters a number?

write a program to display your name age class schoolname e-mail 2hobby based on choice


How do you delete a class zone?

You can't really delete it....


What is the correct declaration of the assignment operator overloaded function inside the travel class?

class travel {...travel &operator=( some type );... or ...travel operator=( some type );...};


The four most common mistakes in C plus plus?

Using the assignment operator (=) instead of the equality operator (==).Failing to terminate a class declaration with a semi-colon (;).Using C-style code (e.g., malloc/free) instead of sticking to C++ principals (e.g., new/delete). If you want to write C-style code, use C, not C++.Ignoring object lifetime (dangling pointers or references).


Which of the class in java.io package defines a method to delete a file?

The java.io.File class in Java has a delete() method to delete the file. See related link for details.


How can write a c program to store students record in a file?

Write a console based C++ program that reads student information from a text file, build an array of objects of type class StudentInfo,


How do you write a program to read set of numbers using by an array and display the ascending order of the given input numbers?

To write a C++ program to display the student details using class and array of object.