Solved

CSingleDocTemplate

Posted on 1998-10-14
3
575 Views
Last Modified: 2013-11-20
I create several instance of CSingleDocTemplate each with a different CRuntimeClass* pViewClass and store them in array.

As the program runs, i need to check the CSingleDocTemplate's view class.

But CSingleDocTemplate's m_pViewClass is protected.  I do i access it?

Below is some of my codes.

CSingleDocTemplate* pTemplate = (CSingleDocTemplate*) m_arrayTemplates.GetAt(i);
if (pTemplate != NULL)
{
   if (pTemplate->m_pViewClass) // error , cannot access protected member
   {
      .....
   }
}
0
Comment
Question by:leowlf
3 Comments
 

Author Comment

by:leowlf
ID: 1323286
Edited text of question
0
 
LVL 12

Accepted Solution

by:
migel earned 50 total points
ID: 1323287
Easy way to check protected member of the class is derive your own class from given and add public function to perform comparation.
for example:
class CMySingelDocTemplate:public CSingleDocTemplate
{
public:
   BOOL IsTemplateViewValid() {return m_pViewClass != NULL;}
// additional methods you neeed
};

after definition you must use this class instead CSingleDocTemplate

0
 
LVL 1

Expert Comment

by:Bridge
ID: 1323288
override csingledoctemplate and write the following funtion;

const CRuntimeClass COverride::GetViewClass( void ) const
{
   ASSERT_VALID(this);

   return *m_pViewClass;
}
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now