Advertisement
Java_Volume1 Miscellaneous #100626

Code Example - explicit keyword

example of the explicit keyword.

AI

Riepilogo AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Codice sorgente
original-source
/* Example of the explicit keyword
  written by Jared Bruni
  www.LostSideDead.com
*/
#include<iostream>

class String
{
private:
	char *str;
public:
	explicit String(int n);
	String();
	~String();
};
String::String()
{
	str = NULL;
}
String::String(int n)
{
	str = new char [ n + 1 ];
}
String::~String()
{
	if(str != NULL)
	{
		delete [] str;
		str = NULL;
	}
}

int main()
{
	String str(100);
	return (0);
}
Commenti originali (3)
Recuperato da Wayback Machine