Redefining Structs

This is a discussion on Redefining Structs within the C++ Programming forums, part of the General Programming Boards category; I want to redefine a struct that is already declared by the win32 api. I just want to add a ...

  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    731

    Redefining Structs

    I want to redefine a struct that is already declared by the win32 api. I just want to add a few operator overloads and stuff to it, but I am not sure how to do this.

  2. #2
    Registered User
    Join Date
    Aug 2002
    Location
    Hermosa Beach, CA
    Posts
    446
    Make a class, that has a different name, that has the win32 struct as a private data member. And then write whatever interface you really want.
    Not sure what you have in mind though...usually I find myself wrapping the Win32 functions into a class, so that I don't have to look at their 15 parameters all the time...
    The crows maintain that a single crow could destroy the heavens. Doubtless this is so. But it proves nothing against the heavens, for the heavens signify simply: the impossibility of crows.

  3. #3
    Registered User
    Join Date
    Aug 2004
    Posts
    731
    alright that sounds like a good idea, what I have right now is I am just stoping it from declaring it's own struct and I am repliating it. It is working ok but I can see flaws in my way. Thanks.

  4. #4
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,639
    you can declare your class within a namespace and derive it directly from the WINAPI struct:

    Code:
    namespace my {
    
    struct WNDCLASSEX : public ::WNDCLASSEX
    {
    	
    };
    
    }
    
    int
    main(void)
    {
    	my::WNDCLASSEX wce;
    }
    Code:
    if( numeric_limits< byte >::digits != bits_per_byte )
        error( "program requires bits_per_byte-bit bytes" );
    24bbs.cpp

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Creating array of structs
    By knirirr in forum C++ Programming
    Replies: 12
    Last Post: 06-18-2008, 08:30 AM
  2. Multidimentional structs + memcpy() == FAIL
    By Viper187 in forum C Programming
    Replies: 8
    Last Post: 06-18-2008, 02:46 AM
  3. packed structs
    By moi in forum C Programming
    Replies: 4
    Last Post: 08-20-2002, 01:46 PM
  4. ArrayLists + Inner Structs
    By ginoitalo in forum C# Programming
    Replies: 5
    Last Post: 05-09-2002, 05:09 AM
  5. Searching structs...
    By Sebastiani in forum C Programming
    Replies: 1
    Last Post: 08-25-2001, 12:38 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21