Conditionally join table
This is not a great design. You have a couple of options to improve it:


Go with your alternative (separate keys). You don't list your requirements, but if it's imperative you only have ONE child record per master record you can enforce this with check constraints.
Put the parent key in the child table. If every child record refers to one master record, just put the masterid in the child table. This also gives you the option of multiple child records per master/parent. If you want to have only one child per parent, remove the surrogate key in the child table and just have the related master id.


Whatever you choose, I would recommend against storing the child table name in a column in the master record. You can make this a "Type" field, but putting meta data into your data always leads to pain down the road. It's also unnecessary if you have separate keys, as you know if you have a FooID value the record type is Foo.