Thread: Redefining Structs

  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,708
    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:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

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