Skip to content
Permalink
1843a14a3e
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
62 lines (47 sloc) 985 Bytes
#include <string>
#include <iostream>
using namespace std;
class Sword : public weapons
{
private:
int sharpness, range;
public:
Sword(int _sharpness,int _range) : weapons(_damage , _durability, _name)
{
sharpness = _sharpness;
range = _range;
}
void setSharpness(_sharpness)
{
sharpness = _sharpness;
}
int getSharpness()
{
return sharpness;
}
void setRange(_range)
{
range = _range;
}
int getRange(_range)
{
return range;
}
};
#include "sword.h"
#include <string>
#include <iostream>
using namespace std;
int main()
{
Sword Sword_sharpnessobj;
sword_sharpnessobj.setSharpness(100);
cout<< sword_sharpnessobj.getSharpness()<< endl;
Sword sword_rangeobj;
sword_rangeobj.setRange(5);
cout << sword_rangeobj.getRange()<<endl;
Sword swordObj(100, 50, "katana");
cout << swordObj.getDamage() << endl;
cout << swordObj.getDurability()<<endl;
cout << swordObj.getName()<<endl;
};