Jump to content

variável publica


esec.rom

Recommended Posts

e' um pouco dificil perceber o que queres realmente...

[irony]

Podes ter 2 solucoes:

-Usas o boost, decerteza que tem alguma funcao para isso.

-Usas COM, as COM sao muito porreiras 🙂

[/irony]

Por muito mais que que estude só aprendo uma coisa, que ainda tenho muita coisa para aprender.

A beleza de um código está em decompor problemas complexos em pequenos blocos simples.

"learn how to do it manually first, then use the wizzy tool to save time."

"Kill the baby, don't be afraid of starting all over again. Fail soon, learn fast."

Link to comment
Share on other sites

#include <iostream>

class Mae {
   protected: // É isto que queres?
       int variavel;
};

class Filha : Mae {
   public:
       void setVariavel(int v);
       void printVariavel();
};

void Filha::setVariavel(int v) { variavel = v; }
void Filha::printVariavel() { printf("%d\n", variavel); }

using namespace std;
int main(int argc, char *argv[]) {
   Filha f;

   f.setVariavel(5);
   f.printVariavel();

   return 0;
}

“There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.”

-- Tony Hoare

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.