I am taking on an assignment where I would like to give the user the chance to decide whether they would like to choose beginner or advanced.

The way I was thinking of achieving this was by marking the method virtual and overriding another method for when an object of the advanced type is calling it.

Would this be an ideal way of doing this?

Thanks
James

Virtual methods are overriden in a derived class, so you could create a base class that has signatures for all the methods you need, then derive a beginner and advanced class from these. Then when the user chooses you create an instance of whatever class you need and the rest of your code doesn't care which it is.

Well I was going to use the beginning class as my base class then derive advanced from it and override the methods and add a few more.

I am only going to have two options: Beginner and Advanced, the user has to choose one of them.

Am I making sense?

Sounds like a plan to me :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.