Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 Encapuslate field and a namespace
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Tomato Guru

315 Posts

Posted - May 28 2020 :  06:50:28 AM  Show Profile  Reply with Quote
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?

Martin Richter [rMVP] WWJD http://blog.m-ri.de
"A well-written program is its own heaven; a poorly written
program is its own hell!" The Tao of Programming

Whole Tomato Software

United Kingdom
18749 Posts

Posted - May 28 2020 :  09:20:50 AM  Show Profile  Reply with Quote
A very good question, and you are right, we don't need to use the namespace here:


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.

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000