Private helper function question. Explaination needed.

Programming MSVC++ 5th edition

ex05a

Step #3 says Add a private ShotFont Helper function to the view class. Add the protype shown as before below in ex05aView.h:

private:
void ShowFont(CDC* pDC, int& nPos, int nPoints);

My question is why there specifically?

I had to look for the solution, no I want to know why there so I can learn and understand.

I was getting the error from the wizard saying it can not find the function untill it got saved at least once.
I save workspace, the program, even closed the program itself and reloaded it.

Can someone explain the reasoning and the logic behind where it has to be there and not just anywhere else.
I googled and used bing and dogpile and no acceptable to my understanding answer.

// ex05aView.h : interface of the CEx05aView class
//
/////////////////////////////////////////////////////////////////////////////

if !defined(AFX_EX05AVIEW_H__B6B0A0ED_9C84_11D1_8ED7_0080C7360DC1__INCLUDED_)

define AFX_EX05AVIEW_H__B6B0A0ED_9C84_11D1_8ED7_0080C7360DC1__INCLUDED_

if _MSC_VER > 1000

pragma once

endif // _MSC_VER > 1000

class CEx05aView : public CView
{
protected: // create from serialization only
CEx05aView();
DECLARE_DYNCREATE(CEx05aView)
// Attributes
public:
CEx05aDoc* GetDocument();
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CEx05aView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual void OnPrepareDC(CDC* pDC, CPrintInfo* pInfo = NULL);
//}}AFX_VIRTUAL

private:
void ShowFont(CDC* pDC, int& nPos, int nPoints);

// Implementation
public:
virtual ~CEx05aView();

ifdef _DEBUG

virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;

endif

protected:
// Generated message map functions
protected:
//{{AFX_MSG(CEx05aView)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};

ifndef _DEBUG // debug version in ex05aView.cpp

inline CEx05aDoc* CEx05aView::GetDocument()
{ return (CEx05aDoc*)m_pDocument; }

endif

/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

endif // !defined(AFX_EX05AVIEW_H__B6B0A0ED_9C84_11D1_8ED7_0080C7360DC1__INCLUDED_)

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories