struct Table
{
char* aTag;
char* bTag;
};
int main()
{
Table T1;
cout<<T1.aTag;
cout<<T1.bTag;
return 0;
}

This might be crazy but... i really need to know
is there any way to so that we can only write

cout<<aTag 
cout<<bTag

instead of T1.aTag like we do in namespace by using namespace <something> for a block.
Can in be done for pointers T1->aTag .
I tried something but have to write each of them for different object...

Why ?

Maybe something like this :

#include <iostream>
#include <string> 
 
using std::cout;
using std::string;
using std::endl;

namespace Curious
{
	string mystery = "Magic";

	struct Wonder
	{
		Wonder(string msg) { mystery = msg; }

	};
}
int main()
{  
	using namespace Curious;

	cout<<mystery<<endl;
	Wonder why("What is going on ? ");
	cout << mystery << endl;
 

	return 0;
}

you are just changing the string ... which is not the member variable.. itself and printing ... its funny... :P

Take a look at this thread. I think this is what you are looking for.

you are just changing the string ... which is not the member variable.. itself and printing ... its funny... :P

Well the idea was to use the string, inside the struct as if it was
a member.

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.