Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Extra libraries, Code snippets, applications etc. » C++ language problems and code snippets » Constructor with parameter
Constructor with parameter [message #9516] Mon, 14 May 2007 07:56 Go to previous message
michael is currently offline  michael
Messages: 153
Registered: May 2007
Location: Germany
Experienced Member
I have a class that creates a Dialog:

class EditDialog : public TopWindow
{
	Button b;
	
	void DoClose()
	{
		Close();
    }
	
	public :
	
	typedef EditDialog CLASSNAME;
	
	EditDialog()
	{
    	SetRect(0, 0, 200, 50);
    	Title("Eintrag editieren");
    	Add(b.SetLabel("Close EditDialog").SizePos());
    	b <<= THISBACK(DoClose);
	}
};


And i have to constructors:

EditDialog createDlg;
EditDialog editDlg;


How can i use variables when creating a new EditDialog? For example:

I want to create a new EditDialog newDlg with a different Title? Can i deliver a String with the constructor like this?

EditDialog newDlg(String Title);


Michael
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Unable to compile with Irrlicht
Next Topic: How to access other classes variables?
Goto Forum:
  


Current Time: Mon Apr 29 18:06:40 CEST 2024

Total time taken to generate the page: 0.02579 seconds