Switch A Port 2 (VLAN 1) <-> Switch A Port 47 (VLAN 2)
Switch A Port 48 (VLAN 2) <-> Switch B Port 1 (VLAN 1)
Let's assume following IPs
PC 192.168.0.1
Switch A 192.168.0.2 (bound to VLAN 1)
Switch B 192.168.0.3 (bound to VLAN 1)
In order to reach Switch B with its IP 192.168.0.3, your client sends out an ARP request into the network. The ARP request being a broadcast is limited to the subnet the client is in. Now you might think that all three devices are in the same /24 subnet and should be in the same broadcast domain.
However, the switch does not know that. For the switch, the broadcast came in from VLAN 1 and will only get sent out to ports with VLAN 1 on them. That's why VLAN<->Subnet should be a 1:1 mapping, otherwise you introduce weirdness into your network which may also differ depending on the hardware you are using.
To connect two switches with VLANs together, the ports between those switches must be Trunk ports (Cisco jargon for tagged ports).
For VLAN 1 and VLAN 2 to be able to talk to each other (assuming the correct setup of different subnets), a layer 3 instance (either router or a layer 3 switch) is required.
I assume this question was of theoretical nature? If not, can you explain why you want to simulate an extra layer 2 switch?