Skip to content

Instantly share code, notes, and snippets.

@Soulstorm50
Created June 12, 2016 18:42
Show Gist options
  • Save Soulstorm50/01e49836f9bcb3e2f13b7e46a3418d67 to your computer and use it in GitHub Desktop.
Save Soulstorm50/01e49836f9bcb3e2f13b7e46a3418d67 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
class Toy //класс игрушка
{
public: // модификатор доступа
char* kind; //разновидность
char* name; // имя игрушки
char* colour; // цвет
int year; // год производства
double weight; //вес
// методы:
void Play() //метод Играть
{
cout <<"You are plaing with "<<name << " toy now.\n";
}
void CheckWeight() //метод проверить вес игрушки
{
cout << "The weight of "<<name << " toy is " << weight << " Kg.\n";
}
};
void main()
{
Toy toy;
toy.name = "Elephant";
toy.colour = "wood colour";
toy.kind = "wood";
toy.year = 2015;
toy.weight = 0.200;
toy.Play();
toy.CheckWeight();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment