Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "gregorian.h"
- #include "julian.h"
- #include <time.h>
- #include <assert.h>
- using namespace lab2;
- using namespace std;
- template <class T> struct bar{
- bar<T>(){
- dp = new T;
- }
- bar<T>(int a){
- dp=new T(a);
- }
- bar<T> & operator=(const bar<T> &ref) {
- *dp=*(ref.dp);
- }
- void print(){
- cout << *dp<<endl;
- };
- Date * dp;
- };
- int main(int argc, char **argv)
- {
- time_t a = time(NULL);
- set_k_time(a);
- bar<Julian> j;
- bar<Gregorian> g;
- bar<Gregorian> g2(20);
- cout << "bar<Julian> j:";
- j.print();
- cout <<"bar<Gregorian> g:";
- g.print();
- cout <<"bar<Gregorian> g2:";
- g2.print();
- cout << "** g=g2 **" <<endl;
- g=g2;
- cout <<"g:";
- g.print();
- cout <<"g2;";
- g2.print();
- cout << "** j=g **"<<endl;
- j=const_cast< bar<Julian> *>g;
- cout << "b";
- //b.print();
- cout <<"f";
- //f.print();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement