Click here to Skip to main content
15,917,473 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Static CLass('s) Pin
ForNow5-Jan-08 18:43
ForNow5-Jan-08 18:43 
GeneralRe: Static CLass('s) Pin
Eytukan5-Jan-08 18:58
Eytukan5-Jan-08 18:58 
GeneralRe: Static CLass('s) Pin
ForNow5-Jan-08 19:03
ForNow5-Jan-08 19:03 
GeneralRe: Static CLass('s) Pin
Eytukan5-Jan-08 19:39
Eytukan5-Jan-08 19:39 
GeneralRe: Static CLass('s) Pin
ForNow5-Jan-08 20:00
ForNow5-Jan-08 20:00 
GeneralRe: Static CLass('s) Pin
Maxwell Chen5-Jan-08 19:08
Maxwell Chen5-Jan-08 19:08 
GeneralRe: Static CLass('s) Pin
Eytukan5-Jan-08 19:37
Eytukan5-Jan-08 19:37 
GeneralRe: Static CLass('s) Pin
Eytukan5-Jan-08 18:28
Eytukan5-Jan-08 18:28 
By chance you are talking about something like :
#include <iostream>
using namespace std;
class one
{
	private:
	int x;
	public:
	one(int x_in)
	{
		cout<<"\n Created only once";
		x = x_in;
	}

	void print()
	{
		cout<<"\n"<<x;
	}

};

class two
{
	int y;
public:
	two()
	{
		y=10;
	}
	void printTest()
	{
	  for(int i=0;i<=10;i++)
	  {
		static one oneObj(y);
		y++;
		oneObj.print();
	  }

	}
};

int main(int argc, char* argv[])
{
	two twoObj;
	twoObj.printTest();
	return 0;
}

Otherwise you just need a singleton.
ReadHere[^]





OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus


Best wishes to Rexx[^]

GeneralArrays Pin
babamara5-Jan-08 12:13
babamara5-Jan-08 12:13 
GeneralRe: Arrays Pin
CPallini5-Jan-08 12:27
mveCPallini5-Jan-08 12:27 
GeneralRe: Arrays Pin
Eytukan5-Jan-08 17:49
Eytukan5-Jan-08 17:49 
GeneralRe: Arrays Pin
Maxwell Chen5-Jan-08 17:56
Maxwell Chen5-Jan-08 17:56 
GeneralRe: Arrays [modified] Pin
babamara5-Jan-08 20:56
babamara5-Jan-08 20:56 
GeneralRe: Arrays Pin
Maxwell Chen5-Jan-08 21:57
Maxwell Chen5-Jan-08 21:57 
GeneralRe: Arrays Pin
babamara5-Jan-08 22:21
babamara5-Jan-08 22:21 
GeneralRe: Arrays Pin
Maxwell Chen5-Jan-08 22:47
Maxwell Chen5-Jan-08 22:47 
GeneralRe: Arrays Pin
babamara5-Jan-08 23:32
babamara5-Jan-08 23:32 
GeneralRe: Arrays Pin
Maxwell Chen6-Jan-08 0:10
Maxwell Chen6-Jan-08 0:10 
QuestionRe: Arrays Pin
CPallini6-Jan-08 3:06
mveCPallini6-Jan-08 3:06 
Generalstatic pointer Pin
jupiter10005-Jan-08 11:59
jupiter10005-Jan-08 11:59 
GeneralRe: static pointer Pin
CPallini5-Jan-08 12:22
mveCPallini5-Jan-08 12:22 
GeneralRe: static pointer Pin
jupiter10005-Jan-08 12:46
jupiter10005-Jan-08 12:46 
GeneralRe: static pointer Pin
CPallini5-Jan-08 13:10
mveCPallini5-Jan-08 13:10 
GeneralProblem with mirrored bitmap Pin
AnTri5-Jan-08 9:04
AnTri5-Jan-08 9:04 
GeneralRe: Problem with mirrored bitmap Pin
Mark Salsbery5-Jan-08 9:50
Mark Salsbery5-Jan-08 9:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.