|
-
January 27th, 2010, 09:10 AM
#15
Re: Polymorphism violating private access modifier
Sorry, I understand that, but I still don't understand how you would enforce that a virtual function declared as private in a derived class but declared public in the base class is not called from a base class object such as the one in my example.
Don't think it's possible without redesigning the language. As nuzzle said the concept of "private" only exists at compile-time. You're asking the virtual call mechanism to enforce access restrictions at runtime, which it's totally incapable of doing in its current form.
I don't have the standard in front of me at the moment, but I wouldn't be surprised if what you're doing is undefined behavior. The whole point of polymorphism is to be able to access a certain functionality through an interface defined by the base class, so if a derived class decides to change that interface.... all bets are probably off.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|