If we disable ip classless command in routers then the router will discard the packet for unknown subnets which fall winthin a kniwn major network but it forward packets via default route which belongs to different networks.
Now i want to know why the router discard packet which only fall within the known major network why not for unknown networks.
no ip classless was the default behaviur before IOS release 12.0.
The classful behaviour of a router is related to the classful old routing protocols like RIPv1 and IGRP.
These routing protocols don't carry the subnet mask in their updates this doesn't mean that subnetting is impossible but that fixed length subnet mask has to be used.
the missing information about the subnet mask is inferred from the subnet mask of another subnet in the same major network.
Because at major network boundaries these protocols perform auto-summarization no detail about far major network is known.
And also a major network cannot be partitioned without causing connectivity problems.
So the roots of this scenario are:
we are connected to this major network X, this major network is a whole, we know all subnets in use in this major network
if a packet arrives that doesn't match any known subnet the packet is discarded.
Here known major networks means major networks to which the router is connected: it has an interface at least whose ip address belongs to the network.
it is impossible to know what are the valid subnets in a non connected major network because just the major network can be known.
Actually packets not belonging to connected major networks follow the default route otherwise the default route would be useless.
Hope to help