Multiple Inheritance Sensor and Logger

#include <iostream>
using namespace std;

class Sensor {
public:
    // your code here: implement void readValue() to print "Reading sensor value"
    void readValue(){
        printf("%s\n", "Reading sensor value"); 
    }
};

class Logger {
public:
    // your code here: implement void logData() to print "Logging data"
    void logData(){
        printf("%s", "Logging data"); 
    }
};

// your code here: define class SmartSensor inheriting publicly from Sensor and Logger
class SmartSensor:public Sensor, Logger{
    public:
    void process(){
        readValue(); 
        logData(); 
    }
};
// implement process() to call both readValue() and logData()

int main() {
    SmartSensor ss;
    ss.process();
    return 0;
}
Upvote
Downvote
Loading...

Input

Expected Output

Reading sensor value Logging data