Elastic properties and electronic structures of CdCNi3: A comparative study with MgCNi3