What do you mean by nameless objects code example

Example: nameless objects

using namespace std;
#include 

class Sample
{
	//private data section
	private:
	int count;
	
	public:
	//default constructor
	Sample()
	{ count = 0;}      

	//parameterized constructor
	Sample(int c)
	{ count = c;}      

	//Operator overloading function definition
	Sample operator++()
	{ 
		++count;
		//returning count of Sample
		//There is no new object here, 
		//Sample(count): is a constructor by passing value of count
		//and returning the value (incremented value)
		return Sample(count);
	}
	
	//printing the value
	void printValue()
	{
		cout<<"Value of count : "<

Tags:

Misc Example