Skip to content

Instantly share code, notes, and snippets.

@spellancer
Last active December 23, 2015 01:19
Show Gist options
  • Save spellancer/6560043 to your computer and use it in GitHub Desktop.
Save spellancer/6560043 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
class A
{
public:
float num;
int num_to_int;
A operator*(A a);
void to_int(A a);
};
A A::multiply(A a)
{
num = num * a.num;
}
void A::to_int(A a)
{
num_to_int = static_cast<int>(a.num);
}
int main()
{
A a;
int x = 10;
a.num = 5;
int y = a * x;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment