I am new to C++, and I am making a simple RPG game. I have an 'Item' class, which has properties and methods that all items will have. I need to be able to:
a) Inherit from this class to make a class with the item properties and methods, along with new ones
b) Make a new instance of this class in my main class. For example in vb.net:
Class MainClass
dim sword as new ItemClass
End Class
Question
McDonger
I am new to C++, and I am making a simple RPG game. I have an 'Item' class, which has properties and methods that all items will have. I need to be able to:
a) Inherit from this class to make a class with the item properties and methods, along with new ones
b) Make a new instance of this class in my main class. For example in vb.net:
I have tried the following in C++:
However this gives me the error:
error C2061: syntax error : identifier 'ItemClass'
so it isn't recognising the other class? Thanks for any help :)
Link to comment
https://www.neowin.net/forum/topic/594046-c-how-to-create-instance-of-another-class/Share on other sites
6 answers to this question
Recommended Posts