Solved

CSingleDocTemplate

Posted on 1998-10-14
3
568 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
Comment Utility
Edited text of question
0
 
LVL 12

Accepted Solution

by:
migel earned 50 total points
Comment Utility
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
Comment Utility
override csingledoctemplate and write the following funtion;

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

   return *m_pViewClass;
}
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

743 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

19 Experts available now in Live!

Get 1:1 Help Now