Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Encapuslate field and a namespace

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
xMRi Posted - May 28 2020 : 06:50:28 AM
I am inside a namespace:

namespace Events
{

class CInboundEvent; 
typedef std::shared_ptr<CInboundEvent>	CInboundEventPtr;

class CInboundEvent : public std::enable_shared_from_this<CInboundEvent>
{
...
	CInboundEventPtr m_spNextEvent;
};


No try and use "encapsulate field".
This resultzs in:


	Events::CInboundEventPtr GetNextEvent() const
	{
		return m_spNextEvent;
	}
	void SetNextEvent(Events::CInboundEventPtr val)
	{
		m_spNextEvent = val;
	}


I would like to have no namespace here. Yes it is correct. But I am in this namespace. So why to use it?
1   L A T E S T    R E P L I E S    (Newest First)
feline Posted - May 28 2020 : 09:20:50 AM
A very good question, and you are right, we don't need to use the namespace here:

case=6114

it's not always obvious when we do and don't need to add the namespace scope information, so we tend to err on the safe side, to make sure you get valid code.

Hopefully not happening all the time you use Encapsulate Field.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000