I have to Classes. lets say Invoice and TempInvoice. Both have same properties(all are same). let say i created a object using Invoice Class. Can i cast that object to another object that i created using tempInvoice ??
ex:
Invoice invoiceobj= getInvoice(int? id) //a method return a invoice object
TempInvoice tempInvoiceObject = invoiceobj// (Need to do it and fill tempInvoice by Invoice Values.even as a new memory location o set by reference.)
Not unless Invoice derives from TempInvoice.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With