#ambiguous error

7 messages · Page 1 of 1 (latest)

thin remnant
#

So I have a Frame (basically just a rectangle) as a base class and 2 sub-classes called TextLabel and Button. I want to create a new class that inherits from both TextLabel and Button to create a class called TextButton but this causes an error saying: reference to 'member of Frame' is ambiguous. Is there a way to inherit from 2 sub-class that are from the same base class?

final spruceBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

inner marlin
#

there are two options: fully-qualified syntax (the TextButton has 2 instances of frame per instance, one for Text and one for Button and can refer to each separately) or virtual inheritance (1 instance of frame for for both Text and Button,:in return virtual inheritance)

#

incase you are wondering this is called the “diamond problem”

#

if you want you can, technically, combine these two options and nobody will ever want to use your progam

thin remnant
#

virtual inheritance worked, ty

#

!solved