___ ___ erkimt How to create a class inside the other in C ++? [closed] ______ qstntxt ___

I need to create a class within another C ++

For example: I already have the Calculator class created. Must enter inside the OperadorAritmetico class. How should I create? How will get the .h header file and .cpp source?

Someone to give me strength?

Thanks!

    
______ ___ azszpr295147

Just use %code% %% within the %code% . Remember that the visibility applies the same as any other method the variable class. In the example below the class %code% is private.

%pre%

The source did not forget to put the full path of the method.

%pre%

In this simple test method %code% of% %code% internally calls the %code% % of %code% .

%pre%     
___

1

I need to create a class within another C ++

For example: I already have the Calculator class created. Must enter inside the OperadorAritmetico class. How should I create? How will get the .h header file and .cpp source?

Someone to give me strength?

Thanks!

    
asked by anonymous 30.04.2018 / 01:24

1 answer

1
___ ___ erkimt How to create a class inside the other in C ++? [closed] ______ qstntxt ___

I need to create a class within another C ++

For example: I already have the Calculator class created. Must enter inside the OperadorAritmetico class. How should I create? How will get the .h header file and .cpp source?

Someone to give me strength?

Thanks!

    
______ ___ azszpr295147

Just use class %% within the class . Remember that the visibility applies the same as any other method the variable class. In the example below the class OperadorAritmetico is private.

// Calculadora HPP

class Calculadora {
  class OperadorAritmetico {
   public:
    int soma(int a, int b);
  };

  OperadorAritmetico operador;

 public:
  int soma(int a, int b);
};

The source did not forget to put the full path of the method.

// Calculadora.cpp
#include <iostream>
#include "Calculadora.hpp"

int Calculadora::OperadorAritmetico::soma( int a, int b )
{
  return a+b;
}

int Calculadora::soma( int a, int b )
{
  return operador.soma( a, b );
}

In this simple test method soma of% Calculadora internally calls the soma % of OperadorAritmético .

int main( void )
{
  Calculadora calc;
  std::cout << "3 + 5 = " << calc.soma( 3, 5 ) << std::endl;
}
    
___
30.04.2018 / 17:45
______ qstntxt ___

I have a small aesthetic problem in 1 dropdown menu.

The problem is this, I increase the padding in CSS (bottom and top) and change only occurs in the last "read" from the menu.

I have made several attempts and found which could change. Did the most spaced submenus stay.

Menu Link: link

    
______ ___ azszpr295546

Frederick had to make some adjustments in the CSS, let the comment in the code, but basically u have to set the %code% , but have to remember to adjust the %code% %% in %code% too. Basically that's it. But you tb need to adjust the heights of the + and - buttons for them to get centralizas. (I've done it but if u want to increase more u will need to center again, tb let it commented in CSS)

Here's how it was in the code below

%pre%
    
___ ___ ___ erkimt JavaScript method ___ ______ ___ azszpr294989

You need to set %code% as an object. So you can build %code% % %code% method as a% function:

%pre%
    
______ ___ azszpr294988

If I create a variable %code% %% %code% is not a function? how I define this method with the function did, in %code% ? if a code as an example, would be very helpful ..

%pre%
    
___