interface M

F

foggy

How to implement such an interface?

Behind the interface, there is a class named M, that contains 5 classes (A,
B, C, D and E). On one situation, it will instantiate A and B, on other
situations, it will instantiate C, D and E.

To interface M, a class X object will instantiate an object of M and then
call member functions of M.

Any idea of implementing this in a good way will be deeply appreciated?
Thanks!
 
P

Phlip

foggy said:
How to implement such an interface?

Behind the interface, there is a class named M, that contains 5 classes (A,
B, C, D and E). On one situation, it will instantiate A and B, on other
situations, it will instantiate C, D and E.

To interface M, a class X object will instantiate an object of M and then
call member functions of M.

Any idea of implementing this in a good way will be deeply appreciated?
Thanks!

What do they do? What do their clients need them for?
 
D

Daniel T.

foggy said:
How to implement such an interface?

Behind the interface, there is a class named M, that contains 5 classes (A,
B, C, D and E). On one situation, it will instantiate A and B, on other
situations, it will instantiate C, D and E.

To interface M, a class X object will instantiate an object of M and then
call member functions of M.

Any idea of implementing this in a good way will be deeply appreciated?
Thanks!

To create an interface, you must know what the clients that use M need
from it. You do not need to know what creates objects that implement M,
or what objects that implement M usually contain. Focus on the clients
of M when creating the interface and it will likely be great.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,166
Messages
2,570,901
Members
47,442
Latest member
KevinLocki

Latest Threads

Top