Advertisement

Hurrendously difficult C++ question

Started by December 21, 2000 08:21 PM
1 comment, last by benjamin bunny 24 years, 1 month ago
If I have a class like this
  
class item_c
{
public:
	item_c(char* name_in)
		{
				sprintf(name,"%s",name_in);
		}
private:
	char name[20];
}
  
and I have the pointer item_c* item_p; How do I go about initializing an object pointed to by item_p if with a string if I use new to allocate the memory? Thanks in advance http://www.geocities.com/ben32768

____________________________________________________________www.elf-stone.com | Automated GL Extension Loading: GLee 5.00 for Win32 and Linux

You mean something like this?:
item_p = new item_c("something");
Advertisement
Yeah. That works. Thanks

http://www.geocities.com/ben32768

____________________________________________________________www.elf-stone.com | Automated GL Extension Loading: GLee 5.00 for Win32 and Linux

This topic is closed to new replies.

Advertisement