Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

CSingleDocTemplate

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

730 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