Is there any drawbacks for using "this" pointer?
For example:

Window_Properties::Window_Properties(wchar_t* wnd_title, wchar_t* wnd_class_name): window_width(1280), window_height(720), window_X(0),	window_Y(0)
{
	this->window_title = new wchar_t[ wcslen( wnd_title ) ];
	if( this->window_title )
	{
		wcscpy( this->window_title, wnd_title );
	}
	
	this->window_class_name = new wchar_t[ wcslen( wnd_class_name ) ];
	if( this->window_class_name )
	{
		wcscpy( this->window_class_name, wnd_class_name );
	}
}

verses

Window_Properties::Window_Properties(wchar_t* wnd_title, wchar_t* wnd_class_name): window_width(1280), window_height(720), window_X(0),	window_Y(0)
{
	window_title = new wchar_t[ wcslen( wnd_title ) ];
	if( window_title )
	{
		wcscpy( window_title, wnd_title );
	}
	
	window_class_name = new wchar_t[ wcslen( wnd_class_name ) ];
	if( window_class_name )
	{
		wcscpy( window_class_name, wnd_class_name );
	}
}

Is it a good practice to use "this" all the time and whenever possible? (for clarity and preventing future errors)

Nope, no drawbacks. The this pointer is just a pointer to the data members of the object..If omitted in member functions its assumed.

Should you use it? It really depends on your preference.

>Is there any drawbacks for using "this" pointer?
It's harder to read and more work to type?

>Is it a good practice to use "this" all the time and whenever possible?
When it comes to this particular usage, I think this should be avoided except to resolve an ambiguity. However, it's a style issue. If you want to add a redundant this-> to everything, feel free.

thanks for the reply :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.