You have domainA.com pointed to your hosting server via an A record to some IP: XXX.XXX.XXX.XXX. You have domainB.com for which you have created a CNAME record to domainA.com:
domainB.com CNAME domainA.com
As a result, both domainA.com and domainB.com will be resolving from the same XXX.XXX.XXX.XXX IP address since domainB.com will be using an IP address set from domainA.com because of the CNAME record. Therefore, the CNAME record is not creating an actual redirect or content but only copying DNS records from the target domain.
You may think that since DNS records are the same, both domains will then resolve to the same website, but it is a common misconception. A CNAME record directs web traffic for a particular domain to the target domain’s IP address. Once the visitor reaches that IP address, the local Apache (or other web server) configuration will determine how the domain is handled. If the domain in question is not configured on the server, the server will simply display its default web page (if any).
This may or may not be the web page for the target domain in the CNAME record, depending on how the server is configured.
Even if a server is configured to serve a CNAME record correctly, some advanced websites based on such CMS as Wordpress, Joomla and others may resolve incorrectly if you point a domain to them via CNAME. As they are highly dependable on the domain these websites were developed for, by default, they are not suited to work under 2 or more different domains.
NOTE: It is not recommended to set up a CNAME record for a naked domain (@ or domain.com) as it will make other records for your domain (such as MX or TXT records) invisible. As a result, the mail service will stop working, and the emails will not get delivered properly. It is possible to create a CNAME record for www.domain.com and then set up a redirect from domain.com to www.domain.com as a workaround.