[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.8

Conflicting Interface

Asked by sindbad in C++ Programming Language


Hi,

1. Class A is an abstract base class
2. clas A has more than one pure virtual functions say
   pv1() and pv2().
3. Class B and C are derived from Class A
4. Class  B and C has their own implementations for pv1() and pv2() (B and C are ensured to be concrete classes).
5. Interface (signature and return type of the functions)of pv1() and pv2() are common across Class A, B and C.
6. Class B and Class C are instantiated.
7. Instances of B and C are referred through a pointer to class A.
8. Methods of instance B and instance C are invoked through the base pointer.
9. So far so good. Now, Class A has a pure virtual method say fn1().
10.This method have implementations in Class B and C.
11. However, the signature for implementations in Class B and Class C are different. Class B's implementation has 3 parameters and Class C implementation has no parameters.

12. If I make fn1() non virtual method only in B and C, I can't invoke through A*.

13. Since I know the type of the object instantiated, I can EXPLICTLY TYPE CAST A* into B* or C*. But this is not a good practice.

14. Alternativley, I thought of providing a pure virtual function fn1()in Class A with 3 parameters(with DEFAULT VALUES ).

 Class B and C will override fn1() and provide PROPER implementation.
 
 Idea is while invoking the method fn1() on instance of B pass the 3 parameters. While invoking fn1() through instance of C, invoke without any parameters.

 But, this too, looks like not proper OO Design.

 Help me.

 Thanks,

 Sindbad

 
Related Solutions
Keywords: Conflicting Interface
Title
1 unions
 
Loading Advertisement...
 
[+][-]04/30/01 11:47 PM, ID: 6041976Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/30/01 11:47 PM, ID: 6041977Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/01/01 02:09 AM, ID: 6042247Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/01/01 04:04 AM, ID: 6042430Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: C++ Programming Language
Sign Up Now!
Solution Provided By: nietod
Participating Experts: 4
Solution Grade: B
 
[+][-]05/01/01 04:13 AM, ID: 6042449Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/01/01 04:22 AM, ID: 6042465Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/01/01 04:52 AM, ID: 6042541Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/01/01 05:26 AM, ID: 6042651Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/01/01 07:08 AM, ID: 6043020Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/01/01 07:30 AM, ID: 6043084Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/01/01 10:22 AM, ID: 6043266Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/01/01 11:24 AM, ID: 6043506Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89