well it's not so much that i want the Dog to BE a cat so much as i want it to be able to perform a couple of Cat functions
or would it be more effective to just write the two or so Cat functions...
Type: Posts; User: Aaronugio
well it's not so much that i want the Dog to BE a cat so much as i want it to be able to perform a couple of Cat functions
or would it be more effective to just write the two or so Cat functions...
Thanks guys for all the help,
I have one last question on the subject,
let's say i have Dog, object, but want it to behave like a Cat object, assuming they're both on the same hierarchy level,...
Ok, i think I've got it now, i adjusted the "new Animal" to being a "new Dog" and added a call to the destructor and it works now.
Thanks again so much for being patient with me, I know I can be...
ok, so I've edited it, and yet again, it compiles, but gives me the same message:
"First-chance exception at 0x004115e6 in Casting Test.exe: 0xC0000005: Access violation reading location...
I know that I'm just trying to get a grasp of casting, for possible future purposes, none in mind yet...
ok, I changed my animal to a pointer, and the situation is pretty much back at the start...
ah... thanks
"Thanks Elysia. You're a programming master! How the hell do you know every thing?"
:)
thanks but that last problem is still there, I'm working in VC++ and it says it's an illegal indirection
any reason why?
So how would I go about making a constructor that could take an Animal object?
Could I make another? or would I have to change my current constructor to fit the Animal conversion?
ok so I've come to the casting section of my book, and I've read and read, and this set of code seems to be right, all it says is that it can't convert down through the classes.
Main.cpp
...
it worked thanks again so much
Thanks you guys I'm sorry if this seemed very wasteful of your time, but thanks for helping me, I've only been seriously trying to learn for about 2 weeks now, but sometimes i just forget parts.
...
Thanks but that has lead me to another problem, when I changed it, it gave me these errors...
: error LNK2019: unresolved external symbol "public: __thiscall number::~number(void)"...
Working in VC++ and here's my problem, was reading through my "SAMS Teach yourself C++ in 1 hour a day" and got to chapter 13 which is supposed to teach operator overloading, but when I modified the...