answersLogoWhite

0

#include <iostream>

class foo{}; // Minimal class declaration.

int main()

{

foo a; // Instantiate an object of the class.

foo b(a); // Instantiate a copy of the class.

return(0);

// Both objects fall from scope at this point.

}

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

Program to generate Fibonacci series using storage class in c plus plus?

i dn't know. haha


Write c plus plus program for new and delete operator using class?

#include&lt;iostream&gt; class foo{ int m_data; }; int main() { foo* p=new foo; delete( foo), foo=NULL; return(0); }


C plus plus program using a stacks converting a postfix-infix?

Yes


Explain instantiation of objects in c plus plus?

Instantiation of a class literally means creating an instance of a class. This is the process of allocating memory for an object that you can use in your program.


Can you use c in c plus plus without using class and object?

Sure.


Program to get a system time using c plus plus?

time in hours second minute


Sample program of c plus plus by using an algorithm union?

The union of two data sequences is the combined set of both sequences. To create a union, copy the first data sequence then append the second to the copy. Both sequences must be of the same type.


A class in a program whose objects are created and destroyed throughout the program It is desired that the total number of live objects in the program be known how you do this in C plus plus?

Create a static member variable to contain the count. This variable is common to all instances of the class.Initialize that variable to zero at the beginning of the program.In the class constructor, increment the variable.In the class destructor, decrement the variable.


What is the program to create a string class which stores a string value in c plus plus?

C++ already provides a string class in the C++ standard template library. #include&lt;iostream&gt; #include&lt;string&gt; int main() { using namespace std; string s {"Hello world!"}; cout &lt;&lt; s &lt;&lt; endl; }


How do you write a program in C plus plus plus plus How do you write a program in C to swap two variables without using the third oneo swap two variables without using the third one?

To swap two variables without using a third variable, use exclusive or manipulation... a ^= b; b ^= a; a ^= b;


How do you write a C plus plus program that displays a pyramid of Xes on the screen using a for loop?

printf ("x")


Can somebody give me the program to find simple interest using friend function in c plus plus?

Here is an example program: class obj{ public: float p,n,r,si; friend void calc( obj temp); }; void calc( obj temp){ si = (p*n*r)/100; } The initialization and function calling is essential.