struct foo1
{
float x, y, z;
};
struct foo2
{
float x, y;
};
struct fooN...// and lot of other foo, although they all contain PODs
template< class... T >
class Bar : public T... {};
typedef Bar<foo1, foo2, foo3> specificBar1;
typedef Bar<foo2, foo4> specificBar2;
typedef Bar<foo1, foo3, foo9> specificBar3;
...
specificBar1 bar;
...
bar.x = 0.1f;// I want to set foo1 'x' ???
I first used search with google, but could not find answer as i don't know exact keywords to search where members have same names. And i don't want to change their names.
BTW. Did i do something wrong to upset you?
If you don't want to help you don't need to spam my thread!
Don't "ok, whatever" someone that's trying to help you. I was basically giving you exactly what you needed to research in order to try to figure out how to resolve what this appears to be faulting at, and your only response was "ok, whatever. Fix it for me."
Your problem isn't that your members have the same name, it's that you need a paradigm shift completely away from multiple inheritance and into polymorphism.
Why would you want to do that? Polymorphism doesn't require this. You'd normally pass bar to functions that work with foo1's or foo2's respectively, so you should seldom get into the situation where such a problem arises.
@morando
Could your write us what kind of a problem you want to solve, and why you should use such structure ?
It is better to write the actual problem, the goal, and than your code. Without knowing what you really want to solve or what you want your code to do, no one could be able to help you well.
It is seems to me that you have some Diamond shaped inheritance problems which causes ambiguity, which in turn can be terminated by using inheritance through virtual Base Classes or by using the scope operator :: . Just the way hanst99 suggested you.
Ok. I have also started to learn DirextX API, and i need some vertex data structures to build various vertex types, so i thought to use variadic template & multiple-inheritance:
I am sorry if i have done something to upset you. I don't know why are you mad at me?
You're no native english speaker, are you? The way you worded it, it sounded as if you were just brushing off his answer.
It is better to write the actual problem, the goal, and than your code. Without knowing what you really want to solve or what you want your code to do, no one could be able to help you well.
Actually, he made it pretty clear what he wanted to do. And there is a definite solution to the problem. Why anyone would use such a structure is beyond the scope of the topic, and I'd guess his actual code looks a little bit different. After all, there are valid (even good) reasons to use multiple inheritance, and name collisions do happen.