Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- class Parent {
- protected:
- char *childName;
- public:
- Parent ( char* _childName ) {
- childName = _childName;
- }
- char *getChildName () {
- return childName;
- }
- };
- class Alpha: public Parent {
- protected:
- const char* alphaName = "ALPHA";
- public:
- Alpha (): Parent ( alphaName ) {
- Serial.print ( F ( "My name is " ) );
- Serial.println ( getChildName () );
- }
- };
- class Beta: public Parent {
- protected:
- const char* betaName = "BETA";
- public:
- Beta (): Parent ( betaName ) {
- Serial.print ( F ( "My name is " ) );
- Serial.println ( getChildName () );
- }
- };
- Alpha *alpha;
- Beta *beta;
- void setup () {
- Serial.begin ( 115200 );
- while (!Serial.availableForWrite ()) {}
- alpha = new Alpha ();
- beta = new Beta ();
- }
- void loop() {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement