This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include <math.h> | |
using namespace std; | |
class Figura { | |
private: | |
float base; | |
float altura; | |
public: | |
void captura(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
class base { | |
int i, j; | |
public: | |
void set(int a, int b) { i = a; j = b; } | |
void mostrar() { cout << i << " " << j << "\n"; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ClaseDerivada : acceso ClaseBase | |
{ | |
//cuerpo de la nueva clase | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main() | |
{ | |
cout << "***Entramos a main" << endl; | |
Prueba objeto(0); | |
{ | |
cout << "***Entramos al bloque" << endl; | |
Prueba objetoA(1); | |
Prueba objetoB(2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//definiciones de las funciones miembro | |
Prueba::Prueba(int numero)//constructor. | |
{ | |
x = numero; | |
cout << "Se ejecuta el constructor del objeto nro: " << (*this).x << endl; | |
} | |
Prueba::~Prueba() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using std::cout; | |
using std::endl; | |
#include <new> | |
class Prueba | |
{ | |
public: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Demostraci贸n de un constructor predeterminado para la clase Tiempo. | |
#include <iostream> | |
using std::cout; | |
using std::endl; | |
// incluye la definici贸n de la clase Tiempo desde tiempo2.h | |
#include "tiempo2.h" | |
int main() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Declaraci贸n de la clase Tiempo. | |
// Las funciones miembro se definen en tiempo2.cpp | |
// previene la inclusi贸n m煤ltiple del archivo de encabezado | |
#ifndef TIEMPO2_H | |
#define TIEMPO2_H | |
// Definici贸n del tipo de dato abstracto Tiempo | |
class Tiempo { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Building.floors = 5; | |
Building.currentFloor = 3; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Building CentroCivico; | |
CentroCivico->goUpStairs(); | |
Building CentroCivico; | |
goUpStairs(&CentroCivico); |