Solved

CSingleDocTemplate

Posted on 1998-10-14
3
606 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
viewing source code from eclipse 13 111
sum67 challenge 35 130
has77  challenge 9 107
How to convert MFC::CString to UTF8 wchar_t* 10 466
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.

710 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