Sunday, February 25, 2018

C++ program : Template Function

#include<iostream>
using namespace std;
class Person {
    public: Person(int x) { cout << x << ":"; }
        Person() {}
};
class Instructor : virtual public Person {
    public: Instructor(int x) :Person(x) { }
};
class Student : virtual public Person {
    public: Student(int x) :Person(x) { }
};
class TA :  public Instructor,  public Student {
    public: TA(int x) :Student(x), Instructor(x) { cout << x * 3 ; }
};
int main() {
    int no;
    cin >> no;
    TA ta(no);
    return 0;
}

Thanks
Happy Computing !

No comments:

Post a Comment

Derivatives stock list at NSE

Complete FNO stock list at NSE. ABB India Ltd ACC Ltd APL Apollo Tubes Ltd AU Small Finance Bank Ltd Aarti Industries Ltd Abbott India Ltd A...