June 12, 2024, 05:04:54 PM
Welcome,
Guest
Home
Help
Search
Login
Register
Recovery
xboxscene.org forums
>
OG Xbox Forums
>
Software Forums
>
Development
>
Polymorphism Problem
« previous
next »
Pages: [
1
]
Print
Author
Topic: Polymorphism Problem (Read 39 times)
MacroHard
Archived User
Newbie
Posts: 2
Polymorphism Problem
«
on:
February 22, 2005, 03:58:00 AM »
Seems like the compiler sees the declaration of Enemy::Burn() but it can't find the definition for it. Are you sure it's really defined someplace (in Enemy_Class.cpp or wherever) ?
Logged
Peeveen
Archived User
Newbie
Posts: 7
Polymorphism Problem
«
Reply #1 on:
February 22, 2005, 08:26:00 AM »
Do you still have implementations for the Enemy::Move() and Enemy::Burn() methods?
If not, I would guess that somewhere in your code you've got a method that creates an instance of Enemy, and now that Enemy is an abstract class, that's not valid.
Logged
Hexstr
Archived User
Newbie
Posts: 2
Polymorphism Problem
«
Reply #2 on:
February 22, 2005, 12:32:00 PM »
Yes Peeveen is correct. You can't create an instance of a class that has abstract methods. In other words you need to have an implementation of Enemy::Burn() even if the code is { return; }.
Logged
Ecrofirt
Archived User
Full Member
Posts: 166
Polymorphism Problem
«
Reply #3 on:
February 22, 2005, 01:12:00 PM »
ah, thanks for the help guys. I'll implement this now, and see if it works. I hope it does, because I've been pulling my hair out over this.
Logged
Ecrofirt
Archived User
Full Member
Posts: 166
Polymorphism Problem
«
Reply #4 on:
February 22, 2005, 01:25:00 PM »
Awesome guys, it worked.
I hadn't thought about the abstract class thing, although looking on it now it was obvious. I know you can't creat objects that are just from an abstract class.
The basic way I've got my enemy generation is:
Enemy *NewEnemy;
NewEnemy=new WhateverType
vEnemies.push_back(NewEnemy);
so I should have caught that right off the bat.
Thanks for the help!
Logged
Print
Pages: [
1
]
« previous
next »
xboxscene.org forums
>
OG Xbox Forums
>
Software Forums
>
Development
>
Polymorphism Problem