Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Changing a variable in ofApp from a child class?

$
0
0

@barrylachapelle wrote:

Hi.

Ive been struggling... how do I access/update a var in ofApp from a child class method? My code so far below...

ofApp:

int variable;    //change this var

childClass child;

void ofApp::setup(){
   child.setup();
}

void ofApp::update(){
   child.update();
}

void ofApp::draw(){
   child.draw();
}

childClass:

class childClass {
}

void childClass::setup(){
}

void childClass::update(){
}

void childClass::draw(){
}

void childClass::customMethod(){
   //change variable from here
}

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles