What makes you think a basement is more defensible? Remember, the undead do not tire so almost any door you have blocking their access will eventually be knocked down. A basement would eventually be overtaken if you give them long enough. An attic, on the other hand, is almost impossible for the undead to access. Zombies lack the coordination to climb so if your house has one of those attics that just have a trap door that you pull down to get in then if you close it the undead will not even realize you're there. They will break into the house, search for prey, and then leave. You can stay in your attic as long as your supplies hold out.