Results 1 to 6 of 6

Thread: No C++ Gurus around here?

  1. #1

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Unhappy No C++ Gurus around here?

    I have a Window class and a Skin template. The Window will call a Skin instance but in it's operation the Skin needs to access some properties of the Window, my first thought was passing a set of pointers but the Skin template is complex enough for the implementation process to be annoying, especially as the Skin template is made as a tool to easily design any type of Skin. My second idea was having the Window inherit a class that the Skin could access, I had though to store all the pointer data in that class which wasn't my intention. The Window should be quite light. My third thought was a bit similar, but this time a Agent_type parameter is passed to the Skin template which the Window inherits to provide information to the Skin.
    I'm not quite sure but if I pass the Window object as a Agent_type will it lose it's ability to access the Window's properties? I've heard about slicing, but not sure if this is the case. Is this idea useless?
    I'm prefering not to use virtual functions for a common Agent base class, just for another bit of performance.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  2. #2
    Frenzied Member Technocrat's Avatar
    Join Date
    Jan 2000
    Location
    I live in the 1s and 0s of everyones data streams
    Posts
    1,024
    *With a bit of drool coming out the side of his mouth*
    I program SEE PLUS PLUS

    You have quite the question there. I am affraid that I do not have an answer for you but a suggestion, you might try to ask this question here:

    http://www.codeguru.com/cgi-bin/bbs/...=list&Board=vc

    If no one else responds to you. I have had great luck asking tuff questions on this board.

    PS. I know you changed it some time ago, but I am glad you do not have that freaky talking avatar anymore
    MSVS 6, .NET & .NET 2003 Pro
    I HATE MSDN with .NET & .NET 2003!!!

    Check out my sites:
    http://www.filthyhands.com
    http://www.techno-coding.com


  3. #3
    Zaei
    Guest
    Could you use Function pointers? Say you have several methods inside of Window that Skin needs to access. Create several functions that get the values skin needs, and returns them (or a single one, that uses pointers), and pass this pointer to Skin at initialization. This function simply gets the values Skin needs. It should work, as long as your Window instance is global.

    Z.

  4. #4

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    That defeats the purpose of the templates And the Window is not a global instance, it's any object of a class deriving a base Window class or it's derivatives.

    Btw, I found out something very stupid in my assumptions, Why have a Agent_Type as a base class for the window when it's a template parameter, the whole Window could be a Agent_Type And that solves my problem Thank you guys for spending efforts in trying to help me though
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5
    wossname
    Guest
    Its nice to see some Douglas Adams quotes around here.

  6. #6

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    That's because he still lives, in a way
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width