Social class is an important theme and background element of setting in Hardy's story. There are several comparisons he makes in very few words as he exposes and presents the divides of social class. These comparisons of one class representative against another are: Randloph against Sam; aristocratic families against poor mothers; gentlemen against other men; respectable acquaintances against unrespectable acquaintances.
Starting with respectable acquaintances compared against unrespectable ones, we are clearly shown that social class depends in part upon the cultivation of the standard English dialect, as irrelevant as that may seem to some. Since Sophy continued to have trouble sorting out the grammatical English usages of "was" and "were" along with "has" and "have," as Randolph points out, ladies born to social class found her unacceptable and kept themselves away from her:
[S]he still held confused ideas on the use of 'was' and 'were,' which did not beget a respect for her among the few acquaintances she made. [...] her almost only companions [were] the two servants of her own house, ...."
Similarly, at the cricket outing, in the midst of aristocratic families, when Sophy hoped to plead her case for marrying Sam in a throng intent upon sporting action, Sophy sees the stark contrast between those in society with whom her son associates and herself. They had "the debris of luxurious luncheons" scattered under their carriages--with some carelessly wealthy enough to even bestrew the "family silver" under the carriages--while Randolph is walking with nothing more than "a poor mother" who is partly lame. Sophy instinctively knows any claim she could make for her love of Sam would fall on blindly unsympathetic ears in a scene where social class was so prominently displayed.
Randolph compared against Sam is probably the most instructive of Hardy's presentation of the artificial nature of social class and its divides. Randolph has had every advantage, "on whose education no expense had been and would be spared," yet he is an unfeeling bully who sees only the wealth and power that he associates with. Perhaps since he sees it as an outsider himself, he is only a country vicar's son after all, he does not see or understand the true power of privilege, which is that privilege serves, privilege does not bully.
In contrast, Sam is respectful to Sophy, though able to speak his mind to her, and he can wait with great patience for Sophy to find her way, even at the cost of his own great sorrow and mourning. As Hardy presents Randolph, Randolph belies a social class divide of gentlemen compared against other men. He calls upon the "eyes of all the gentlemen of England" as his authority for demanding that his mother not wed Sam. Randolph belies a social class divide between gentlemen and other men because Sam is the one who is gentlemanly in motive and conduct, whereas Randolph is only gentlemanly in manners and power.
He hoped his stepfather would be a gentleman? he said. "Not what you call a gentleman," she answered timidly, ... The youth's face remained fixed for a moment; then he flushed, leant on the table, and burst into passionate tears. [...] "I am ashamed of you! It will ruin me! A miserable boor! a churl! a clown! It will degrade me in the eyes of all the gentlemen of England!"