It compiles, great, but is it doing what I want it to?Code:#include "stdafx.h" #include <iostream.h> class Transportation { public: double dCarEngineSize; int iMotorcycleCCs; int iSemiNumberofAxels; }; int main(int argc, char* argv[]) { Transportation& vehicleInfo = *(new Transportation); vehicleInfo.dCarEngineSize = 3.1; vehicleInfo.iMotorcycleCCs = 750; vehicleInfo.iSemiNumberofAxels = 6; cout << vehicleInfo.dCarEngineSize << endl << vehicleInfo.iMotorcycleCCs << endl << vehicleInfo.iSemiNumberofAxels << endl; delete &vehicleInfo; return 0; }
I want to delete the object from the heap, so it doesn't cause a leak, is this correct? If not, what am I doing wrong?



LinkBack URL
About LinkBacks



, I think thats what you're saying ancientdragon