Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef location_h
- #define location_h
- class location
- {
- public:
- setpoint(int,int,int);
- getpoint(int,int,int);
- private:
- int x,y,z;
- };
- #endif
- #include<iostream>
- using std::cout;
- using std::cin;
- using std::endl;
- #include"location.h"
- location::getpoint(int a,int b,int c)
- {
- x=a;
- y=b;
- z=c;
- cout<<"give point x"<<x<<endl;
- cout<<"give point y"<<y<<endl;
- }
- #ifndef creature_h
- #define creature_h
- #include"location.h"
- #include<string>
- //using std::string;
- using namespace std;
- class creature
- {
- public:
- creature();
- moveto(location l);
- getname(string n);
- printlocation(string ,location );
- private:
- location lo;
- string name;
- };
- #endif
- #include<iostream>
- using std::cout;
- using std::endl;
- using std::cin;
- using namespace std;
- #include<string>
- #include"creature.h"
- #include"location.h"
- creature::creature()
- {
- lo;
- name;
- }
- creature::getname(string n)
- {
- name=n;
- cout<<"enter name";
- cin>>n;;
- }
- creature::printlocation()
- :name(n),lo(l)
- {
- name=n;
- lo=l;
- cout<<lo.setpoint(int,int,int);
- }
- #ifndef creature_h
- #define creature_h
- #include"location.h"
- #include<string>
- //using std::string;
- using namespace std;
- class creature
- {
- public:
- creature();
- void moveto(location l);
- void getname(string );
- void printlocation(string ,location );
- private:
- location lo;
- string name;
- };
- #endif
- #include<iostream>
- using std::cout;
- using std::endl;
- using std::cin;
- using namespace std;
- #include<string>
- #include"creature.h"
- #include"location.h"
- /*creature::creature()
- {
- lo;
- name;
- }*/
- void creature::getname(string n)
- {
- name=n;
- cout<<"enter name";
- cin>>n;
- }
- void creature::printlocation()
- :name(n),lo(l)
- {
- name=n;
- lo=l;
- cout<<l.getpoint(int,int,int);
- }
- #include<iostream>
- using std::cout;
- using std::cin;
- using std::endl;
- using namespace std;
- #include"location.h"
- #include"creature.h"
- #include<string>
- main()
- {
- string n;
- int x,y,z;
- location l;
- l.getpoint(x,y,z);
- creature c;
- c.getname(n);
- c.printlocation(n,l);
- return 0;
- }
- void printlocation( std::string ,location );
- void creature();
- void moveto(location l);
- void getname(string n);
- std::string s;
- location l;
- //... give some value to s and l ...
- printlocation( s, l);
- class location
- {
- public:
- setpoint(int,int,int);
- getpoint(int,int,int);
- //...
- class creature
- {
- public:
- //...
- moveto(location l);
- getname(string n);
- printlocation(string ,location );
- //...
- void setpoint(int,int,int);
- location::getpoint(int a,int b,int c)
- {
- x=a;
- y=b;
- z=c;
- cout<<"give point x"<<x<<endl;
- cout<<"give point y"<<y<<endl;
- }
- void location::setpoint(int a,int b,int c)
- {
- x=a;
- y=b;
- z=c;
- cout<<"give point x"<<x<<endl;
- cout<<"give point y"<<y<<endl;
- }
- // NOTE the parameter defintions!!
- void creature::printlocation(string n,location l) {
- name=n;
- lo=l;
- cout<<lo.setpoint(1,2,3);
- }
- void creature::printlocation() : name(n),lo(l)
- // ^^^^^^^^^^^^^^^ This is wrong!!!
- class creature {
- public:
- creature() (string n,location l) : name(n),lo(l) {}
- // ...
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement