Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream.h>
- #include <conio.h>
- #include <string>
- using namespace std;
- class Vehicle {
- private:
- string registracijas_numurs;
- int rezosanas_gads;
- string valsts_razotajs;
- public:
- Vehicle(string, string, int);
- Vehicle();
- // Vehicle(int, string, string);
- ~Vehicle() {
- cout << "Message from the \"CVehicle\" - destroyed!" << endl;
- }
- int GetGads() const{
- return rezosanas_gads;
- };
- void SetGads(int x);
- string GetRazotajs() const;
- void SetRazotajs(string x);
- string GetNumurs() const;
- void SetNumurs(string x);
- void Print() const;
- };
- Vehicle::Vehicle(string numurs, string valsts, int gads){
- registracijas_numurs=numurs;
- valsts_razotajs=valsts;
- rezosanas_gads=gads;
- }
- Vehicle::Vehicle(): registracijas_numurs("0"), valsts_razotajs("non"),rezosanas_gads(2000) {
- }
- inline void Vehicle::SetGads(int x) {
- this->rezosanas_gads = x;
- }
- inline string Vehicle::GetRazotajs() const{
- return valsts_razotajs;
- };
- inline void Vehicle::SetRazotajs(string x){
- valsts_razotajs=x;
- };
- inline string Vehicle::GetNumurs() const{
- return registracijas_numurs ;
- };
- inline void Vehicle::SetNumurs(string x){
- registracijas_numurs=x;
- };
- //CoordPoint::CoordPoint() : X(0), Y(0) {
- //}
- //CoordPoint::CoordPoint(int Px, int Py) : X(Px) {
- // Y = Py;
- //}
- /*inline int CoordPoint::GetY() const {
- return Y;
- }
- inline void CoordPoint::SetY(int Y) {
- this->Y = Y;
- }*/
- inline void Vehicle::Print() const {
- cout << "Registracijas numurs = " << registracijas_numurs << ", Razosanas gads = " << rezosanas_gads<<", Razots - "<< valsts_razotajs<<endl;
- }
- void main(void) {
- Vehicle bmw("BM9766", "LV", 1992);
- Vehicle *audi= new Vehicle("DE1234", "Germany", 1998);
- Vehicle *golf;
- golf = new Vehicle();//("GO5435", "USA", 1765);
- Vehicle skoda= Vehicle("Sk4321", "IT", 1777);
- skoda.Print();
- golf->Print();
- bmw.Print();
- audi->Print();
- skoda.SetRazotajs("LT");
- bmw.SetGads(3999);
- audi->SetNumurs("qwe1234");
- skoda.Print();
- golf->Print();
- bmw.Print();
- audi->Print();
- /*
- CoordPoint CP1, CP2(1,2), CP3 = CoordPoint(3, 4),
- *CP4 = new CoordPoint(5, 6), *CP5;
- CP5 = new CoordPoint(7, 8);
- clrscr();
- CP1.Print();cout<<endl;
- CP1.SetX(1);
- CP1.CoordPoint::Print();cout<<endl;
- cout << endl << "**************" << endl << endl;
- (*CP4).Print();cout<<endl;
- CP4->SetY(9);
- CP4->Print();cout<<endl;
- (*CP4).CoordPoint::Print();cout<<endl;
- CP5->CoordPoint::Print();cout<<endl;
- delete CP4;
- delete CP5;
- */
- delete golf;
- delete audi;
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement