[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Remove inherited method?

Posted on 2009-04-11
3
Medium Priority
?
400 Views
Last Modified: 2013-12-14
Hello,

My C++ is a little rusty but I believe that I cannot  mark an inherited virtual method as "ignore" or "remove" or "delete" so it is not available to subclasses.  In the past, I simply "override" the method in the subclass and threw an Exception that indicated that this method was not available to the subclass.  Is there a better way to handle this situation?

Oh!  In case it matters... I am using the latest version of MSVS C++ CLI.

Thanks for your help,
Mike
0
Comment
Question by:mjgardne
[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
 
LVL 86

Accepted Solution

by:
jkr earned 1600 total points
ID: 24123888
>>My C++ is a little rusty but I believe that I cannot  mark an inherited virtual
>>method as "ignore" or "remove" or "delete" so it is not available to
>>subclasses.

Make it 'private'. Methods declared in the 'private' section of a class are not accessible from derived classes.
0
 
LVL 6

Assisted Solution

by:peter41
peter41 earned 400 total points
ID: 24124654
If methods which you want to hide must stay public in base class,
you can leave them 'public' and make 'private' inheritance, for example:
class CBaseClass
{
public:
...
}
class CNewClass : private CBaseClass
{
...
}
 Thus public methods in base class will not stay public in derived class.
0
 

Author Closing Comment

by:mjgardne
ID: 31569237
Geez!  I was lost in the details and missed the obvious!  Thanks, Guys!  I tagged the methods as private, et voila, the subclasses don't see them.
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

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

656 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