Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

CSingleDocTemplate

Posted on 1998-10-14
3
Medium Priority
?
641 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 100 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

[Webinar] Cloud Security

In this webinar you will learn:

-Why existing firewall and DMZ architectures are not suited for securing cloud applications
-How to make your enterprise “Cloud Ready”, and fix your aging DMZ architecture
-How to transform your enterprise and become a Cloud Enabler

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…

916 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