Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Inheritance from Shape  (Read 4571 times)

0 Members and 1 Guest are viewing this topic.

shekel

  • Newbie
  • *
  • Posts: 1
    • View Profile
Inheritance from Shape
« on: June 06, 2021, 10:35:14 am »
Hello everybody.

I am creating a button (RectangleShape + Text) and the basic functionality works correctly.

My problem is when I want to use for example 'setOutlineColor', nothing happens.

Should I overwrite all the methods? Or can I indicate that all properties apply to the RectangleShape?

Sorry for my english, this is google translator

Stauricus

  • Sr. Member
  • ****
  • Posts: 369
    • View Profile
    • A Mafia Graphic Novel
    • Email
Re: Inheritance from Shape
« Reply #1 on: June 06, 2021, 01:18:23 pm »
maybe you got to the same problem I did a while ago. both Text and Shape have setOutlineColor.
in my case, I had to use Text and Sprite as members of the class I was creating. I looked into some GUI libraries made with SFML (I dont remember exactly which ones), and they also did it like this.
Visit my game site (and hopefully help funding it? )
Website | IndieDB

kojack

  • Sr. Member
  • ****
  • Posts: 299
  • C++/C# game dev teacher.
    • View Profile
Re: Inheritance from Shape
« Reply #2 on: June 06, 2021, 03:24:40 pm »
It looks like this isn't using inheritance, it appears to be aggregation of rectangleshape (it's got a pointer to one). But we'd need to see the whole class to see where it might be going wrong.

G.

  • Hero Member
  • *****
  • Posts: 1590
    • View Profile
Re: Inheritance from Shape
« Reply #3 on: June 06, 2021, 05:24:47 pm »