Link to home
Start Free TrialLog in
Avatar of Wanting2LearnMan
Wanting2LearnManFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Abstract base class question C++

I I have an abstract base class in c++ as follows:
	class IMyBaseClass
	{
	public :
		virtual ~IMyBaseClass() {}
		virtual void AddSomeInformation( int param1, int param2) = 0;
		virtual void AddSomeMoreInformation( int param1) = 0;
	};

Open in new window


When I go to implement a class with this interface as follows:

       class MyBaseClass : public IMyBaseClass
	{
	public :
		virtual ~IMyBaseClass() {}
		void AddSomeInformation( int param1, int param2);
		void AddSomeMoreInformation( int param1);
	};

Open in new window


Do I have to include the word virtual before the function name in this class definition??
e.g.
virtual void AddSomeInformation( int param1, int param2);

Open in new window


instead of just:
void AddSomeInformation( int param1, int param2);

Open in new window


Can you explain your answer please?
ASKER CERTIFIED SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial