Click here to Skip to main content
15,880,956 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: ERROR No Target Architecture Pin
ForNow2-Nov-14 4:04
ForNow2-Nov-14 4:04 
GeneralRe: ERROR No Target Architecture Pin
Richard MacCutchan2-Nov-14 5:49
mveRichard MacCutchan2-Nov-14 5:49 
QuestionHow to protect a member function Pin
Drugodrf31-Oct-14 4:35
Drugodrf31-Oct-14 4:35 
AnswerRe: How to protect a member function Pin
Jochen Arndt31-Oct-14 5:18
professionalJochen Arndt31-Oct-14 5:18 
AnswerRe: How to protect a member function Pin
Chris Losinger31-Oct-14 5:18
professionalChris Losinger31-Oct-14 5:18 
GeneralRe: How to protect a member function Pin
Drugodrf3-Nov-14 2:31
Drugodrf3-Nov-14 2:31 
AnswerRe: How to protect a member function Pin
Albert Holguin3-Nov-14 11:39
professionalAlbert Holguin3-Nov-14 11:39 
AnswerRe: How to protect a member function Pin
Aescleal4-Nov-14 2:29
Aescleal4-Nov-14 2:29 
(Bit late to the party... still think this is worth saying and it might help you in future)

If you ever find yourself wanting to use a class but there's aspects of it's interface that you don't want to work with then don't try and modify the class you want to use - that way lies madness and hackiness of the first degree. If the class with the relatively fat interface really needs a big interface somewhere else you don't want to break that. So what can you do about it? Wheel out the software engineer's swiss army knife - another level of indirection!

So if you've got a class:

C++
class fat_and_dangerous
{
	public:
		void safe();
		void dangerous();
};


and don't want clients to use dangerous() implement another class using it:

C++
class skinny_and_safe
{
	public:
		skinny_and_safe() : fat_( new fat_and_dangerous ) {}

		void safe() { fat_->safe(); }

	private:
		std::unique_ptr<fat_and_dangerous> fat_;
}


and in most of your client code only use skinny_and_safe.

Just out of interest... don't actually implement skinny_and_safe inline. It leaks too many implementation details to the client. Don't worry about performance - most compilers (actually linkers working with compilers) these days will elide the indirect call - until a profiler tells you that it's slow.
GeneralRe: How to protect a member function Pin
Drugodrf4-Nov-14 7:41
Drugodrf4-Nov-14 7:41 
GeneralRe: How to protect a member function Pin
Aescleal4-Nov-14 21:27
Aescleal4-Nov-14 21:27 
QuestionI can't figure out why my program is not running Pin
Member 1119464630-Oct-14 18:47
Member 1119464630-Oct-14 18:47 
AnswerRe: I can't figure out why my program is not running Pin
enhzflep30-Oct-14 21:12
enhzflep30-Oct-14 21:12 
QuestionResources for OOP practice for C++ Pin
Member 1119427030-Oct-14 14:12
Member 1119427030-Oct-14 14:12 
AnswerRe: Resources for OOP practice for C++ Pin
Richard MacCutchan30-Oct-14 22:52
mveRichard MacCutchan30-Oct-14 22:52 
GeneralMessage Closed Pin
1-Nov-14 19:47
4india1-Nov-14 19:47 
GeneralRe: Resources for OOP practice for C++ Pin
Richard MacCutchan1-Nov-14 21:53
mveRichard MacCutchan1-Nov-14 21:53 
GeneralRe: Resources for OOP practice for C++ Pin
OriginalGriff16-Nov-14 22:37
mveOriginalGriff16-Nov-14 22:37 
GeneralRe: Resources for OOP practice for C++ Pin
Richard MacCutchan16-Nov-14 22:46
mveRichard MacCutchan16-Nov-14 22:46 
QuestionDump file creation Pin
HungryCPPDev29-Oct-14 20:52
HungryCPPDev29-Oct-14 20:52 
AnswerRe: Dump file creation Pin
den2k8830-Oct-14 0:37
professionalden2k8830-Oct-14 0:37 
GeneralRe: Dump file creation Pin
HungryCPPDev30-Oct-14 20:37
HungryCPPDev30-Oct-14 20:37 
AnswerRe: Dump file creation Pin
bert_r30-Oct-14 5:16
bert_r30-Oct-14 5:16 
GeneralRe: Dump file creation Pin
HungryCPPDev30-Oct-14 20:36
HungryCPPDev30-Oct-14 20:36 
QuestionC code : read infomation of USB Pin
Member 1119126829-Oct-14 15:36
Member 1119126829-Oct-14 15:36 
GeneralRe: C code : read infomation of USB Pin
PIEBALDconsult29-Oct-14 17:30
mvePIEBALDconsult29-Oct-14 17:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.