Yes, we can sometimes count cakes as a type of pastry or vis-;-vis. In one sense of the word, the baked cake can also be called otherwise. According to the definition, all sweet and sweet food items made of sugar, fat, flour, and flavouring are baked. These include both cakes and types of pastries. So we can assume using both names interchangeably.