Discussion:
[omniORB] two interfaces and factory function
Ronald Andrae
2008-02-28 23:37:00 UTC
Permalink
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20080228/76bf7696/attachment.htm
Wernke Zur Borg
2008-02-29 19:25:17 UTC
Permalink
Of Ronald Andrae
Sent: 28 February 2008 18:37
Subject: [omniORB] two interfaces and factory function
Hello,
I have a IDL with a factory interface and two other interfaces,
interface User {
//...
};
interface Student : User {
//...
};
now I want to use the factory function in C++.
Student_ptr createStudent() {
Student_impl *newStudent = new Student_impl();
Student_ptr sp = newStudent->Student_impl::_this();
return sp;
}
The problem is that the "_this()" function want to use the
User class. How I can fix this problem?
What problem? Can you try to describe it a bit better? What do you mean
with "use the User class" ?

Have you defined Student_impl as a subclass of User_impl?

And why don't you simply write

Student_ptr sp = newStudent->_this(); ?

Cheers, Wernke
Ronald Andrae
2008-03-01 03:45:57 UTC
Permalink
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20080229/f1537b69/attachment.htm
Duncan Grisby
2008-03-01 21:56:13 UTC
Permalink
I have defined,
class Student_impl : public POA_Student, public User_impl {
//..
}
when I use "_this()" in the factory function, I get an error that the
compiler has a multiple choise.
Please don't send html email to the omniORB mailing list. It upsets the
mailing list archive.

You need to use virtual inheritance throughout your inheritance
hierarchy, then the compiler will know what to do.

Cheers,

Duncan.
--
-- Duncan Grisby --
-- ***@grisby.org --
-- http://www.grisby.org --
Loading...