Category : object

I have a Class "Parent1" and another "Parent2", which symbolize different hardware implementations of a device "Subclass". What is the most elegant way of implementing this? I have thought about using templates e.g. class Parent1{ public: Parent1(): void run(); }; class Parent2{ public: Parent2(): void run(); }; template<typename Parent> class Subclass : Parent { public: ..

Read more

Account.h file #ifndef ACCOUNT_H #define ACCOUNT_H class Account { private: //attributes double balance; public: //methods void set_balance(double bal); double get_balance(); }; #endif Account.cpp file #include "Account.h" void Account::set_balance(double bal){ balance=bal; } double Account::get_balance(){ return balance; } main.cpp file #include<iostream> #include"Account.h" int main(){ Account frank_account; frank_account.set_balance(200.00); double showBalance=frank_account.get_balance(); return 0; } error C:UsersDellAppDataLocalTempccZOi0ua.o: In function `main’: ..

Read more