• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
87fg8df7g8df7g87sd7f8s7df8sdf7
 

87fg8df7g8df7g87sd7f8s7df8sdf7

on

  • 504 views

 

Statistics

Views

Total Views
504
Views on SlideShare
504
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

87fg8df7g8df7g87sd7f8s7df8sdf7 87fg8df7g8df7g87sd7f8s7df8sdf7 Presentation Transcript

  • Unix ProgrammingC++ and QtFebruary 2010
  • C++✤ Object Orientated Language ✤ Adds to the C Language ✤ Pre-dates Java and C# ✤ Fully Compiled ✤ Standard Libraries (such as strings)
  • C++✤ Points of interest ✤ Multiple Inheritance ✤ Operator overloading ✤ Templates ✤ Strings
  • C++✤ Things you might miss ✤ No garbage collection - manual memory management ✤ No collections ✤ You can use the Standard Template Library (STL)
  • Qt✤ Cross platform GUI framework ✤ Compatible at source level✤ C++ based Object Orientated Framework ✤ With some (rather good) Qt extensions ✤ Lots of useful components (strings, networking, Variant data types etc..)✤ Available on Linux, Mac OS, Symbian, MS Windows,........
  • Part A - Anatomy of a C++ ProgramThe classclass declaration (header file) class implementation (cpp file)class MyClass #include "myclass.h"{private: MyClass::MyClass() { int age; MyClass(0); } void anotherBirthday() { age++; MyClass::MyClass(int initialValue) { } this->setAge(initialValue); }public: MyClass(); MyClass::~MyClass() { MyClass(int initialValue); age = 0; } ~MyClass(); int getAge() { void MyClass::setAge(int v) { return age; if (age == v) return; } age = v; void setAge(int v); }};
  • Part A - Anatomy of a C++ ProgramThe classclass declaration (header file) class implementation (cpp file)class MyClass #include "myclass.h"{private: MyClass::MyClass() { int age; MyClass(0); } void anotherBirthday() { age++; MyClass::MyClass(int initialValue) { } this->setAge(initialValue); }public: MyClass(); MyClass::~MyClass() { MyClass(int initialValue); age = 0; } ~MyClass(); int getAge() { void MyClass::setAge(int v) { return age; if (age == v) return; } age = v; void setAge(int v); }};
  • Part A - Anatomy of a C++ ProgramThe classclass declaration (header file) class implementation (cpp file)class MyClass #include "myclass.h"{private: MyClass::MyClass() { int age; MyClass(0); } void anotherBirthday() { age++; MyClass::MyClass(int initialValue) { } this->setAge(initialValue); }public: MyClass(); MyClass::~MyClass() { MyClass(int initialValue); age = 0; } ~MyClass(); int getAge() { void MyClass::setAge(int v) { return age; if (age == v) return; } age = v; void setAge(int v); }};
  • Part A - Anatomy of a C++ ProgramThe classclass declaration (header file) class implementation (cpp file)class MyClass #include "myclass.h"{private: MyClass::MyClass() { int age; MyClass(0); } void anotherBirthday() { age++; MyClass::MyClass(int initialValue) { } this->setAge(initialValue); }public: MyClass(); MyClass::~MyClass() { MyClass(int initialValue); age = 0; } ~MyClass(); int getAge() { void MyClass::setAge(int v) { return age; if (age == v) return; } age = v; void setAge(int v); }};
  • Part A - Anatomy of a C++ ProgramThe classclass declaration (header file) class implementation (cpp file)class MyClass #include "myclass.h"{private: MyClass::MyClass() { int age; MyClass(0); } void anotherBirthday() { age++; MyClass::MyClass(int initialValue) { } this->setAge(initialValue); }public: MyClass(); MyClass::~MyClass() { MyClass(int initialValue); age = 0; } ~MyClass(); int getAge() { void MyClass::setAge(int v) { return age; if (age == v) return; } age = v; void setAge(int v); }};
  • Part A - Anatomy of a C++ ProgramThe classclass declaration (header file) class implementation (cpp file)class MyClass #include "myclass.h"{private: MyClass::MyClass() { int age; MyClass(0); } void anotherBirthday() { age++; MyClass::MyClass(int initialValue) { } this->setAge(initialValue); }public: MyClass(); MyClass::~MyClass() { MyClass(int initialValue); age = 0; } ~MyClass(); int getAge() { void MyClass::setAge(int v) { return age; if (age == v) return; } age = v; void setAge(int v); }};
  • Part A - Anatomy of a C++ ProgramThe classclass declaration (header file) class implementation (cpp file)class MyClass #include "myclass.h"{private: MyClass::MyClass() { int age; MyClass(0); } void anotherBirthday() { age++; MyClass::MyClass(int initialValue) { } this->setAge(initialValue); }public: MyClass(); MyClass::~MyClass() { MyClass(int initialValue); age = 0; } ~MyClass(); int getAge() { void MyClass::setAge(int v) { return age; if (age == v) return; } age = v; void setAge(int v); }};
  • Part A - Anatomy of a C++ ProgramThe classclass declaration (header file) class implementation (cpp file)class MyClass #include "myclass.h"{private: MyClass::MyClass() { int age; MyClass(0); } void anotherBirthday() { age++; MyClass::MyClass(int initialValue) { } this->setAge(initialValue); }public: MyClass(); MyClass::~MyClass() { MyClass(int initialValue); age = 0; } ~MyClass(); int getAge() { void MyClass::setAge(int v) { return age; if (age == v) return; } age = v; void setAge(int v); }};
  • Part A - Anatomy of a C++ ProgramThe classclass declaration (header file) class implementation (cpp file)class MyClass #include "myclass.h"{private: MyClass::MyClass() { int age; MyClass(0); } void anotherBirthday() { age++; MyClass::MyClass(int initialValue) { } this->setAge(initialValue); }public: MyClass(); MyClass::~MyClass() { MyClass(int initialValue); age = 0; } ~MyClass(); int getAge() { void MyClass::setAge(int v) { return age; if (age == v) return; } age = v; void setAge(int v); }};
  • Part A - Anatomy of a C++ ProgramThe classclass declaration (header file) class implementation (cpp file)class MyClass #include "myclass.h"{private: MyClass::MyClass() { int age; MyClass(0); } void anotherBirthday() { age++; MyClass::MyClass(int initialValue) { } this->setAge(initialValue); }public: MyClass(); MyClass::~MyClass() { MyClass(int initialValue); age = 0; } ~MyClass(); int getAge() { void MyClass::setAge(int v) { return age; if (age == v) return; } age = v; void setAge(int v); }};
  • Part A - Anatomy of a C++ ProgramThe classclass declaration (header file) class implementation (cpp file)class MyClass #include "myclass.h"{private: MyClass::MyClass() { int age; MyClass(0); } void anotherBirthday() { age++; MyClass::MyClass(int initialValue) { } this->setAge(initialValue); }public: MyClass(); MyClass::~MyClass() { MyClass(int initialValue); age = 0; } ~MyClass(); int getAge() { void MyClass::setAge(int v) { return age; if (age == v) return; } age = v; void setAge(int v); }};
  • Part A - Anatomy of a C++ ProgramThe classclass declaration (header file) class implementation (cpp file)class MyClass #include "myclass.h"{private: MyClass::MyClass() { int age; MyClass(0); } void anotherBirthday() { age++; MyClass::MyClass(int initialValue) { } this->setAge(initialValue); }public: MyClass(); MyClass::~MyClass() { MyClass(int initialValue); age = 0; } ~MyClass(); int getAge() { void MyClass::setAge(int v) { return age; if (age == v) return; } age = v; void setAge(int v); }};
  • Part A - Anatomy of a C++ ProgramThe classclass declaration (header file) class implementation (cpp file)class MyClass #include "myclass.h"{private: MyClass::MyClass() { int age; MyClass(0); } void anotherBirthday() { age++; MyClass::MyClass(int initialValue) { } this->setAge(initialValue); }public: MyClass(); MyClass::~MyClass() { MyClass(int initialValue); age = 0; } ~MyClass(); int getAge() { void MyClass::setAge(int v) { return age; if (age == v) return; } age = v; void setAge(int v); }};
  • Part A - Anatomy of a C++ ProgramThe classclass declaration (header file) class implementation (cpp file)class MyClass #include "myclass.h"{private: MyClass::MyClass() { int age; MyClass(0); } void anotherBirthday() { age++; MyClass::MyClass(int initialValue) { } this->setAge(initialValue); }public: MyClass(); MyClass::~MyClass() { MyClass(int initialValue); age = 0; } ~MyClass(); int getAge() { void MyClass::setAge(int v) { return age; if (age == v) return; } age = v; void setAge(int v); }};
  • Part A - Anatomy of a C++ ProgramThe classclass declaration (header file) class implementation (cpp file)class MyClass #include "myclass.h"{private: MyClass::MyClass() { int age; MyClass(0); } void anotherBirthday() { age++; MyClass::MyClass(int initialValue) { } this->setAge(initialValue); }public: MyClass(); MyClass::~MyClass() { MyClass(int initialValue); age = 0; } ~MyClass(); int getAge() { void MyClass::setAge(int v) { return age; if (age == v) return; } age = v; void setAge(int v); }};
  • Part A - Anatomy of a C++ ProgramThe classclass declaration (header file) class implementation (cpp file)class MyClass #include "myclass.h"{private: MyClass::MyClass() { int age; MyClass(0); } void anotherBirthday() { age++; MyClass::MyClass(int initialValue) { } this->setAge(initialValue); }public: MyClass(); MyClass::~MyClass() { MyClass(int initialValue); age = 0; } ~MyClass(); int getAge() { void MyClass::setAge(int v) { return age; if (age == v) return; } age = v; void setAge(int v); }};
  • Instantiating objects✤ Two options ✤ MyClass a(18); ✤ a.setAge(21);✤ Pointer type (heap only) ✤ MyClass *a; ✤ a = new MyClass(); ✤ a->setAge(21); ✤ delete a;
  • Strings✤ C++ has a standard string library ✤ #include <string> ✤ Create strings: ✤ std::string s = "Hello"; ✤ Concatenate strings using “operator overloading” ✤ s = s + " world";
  • Videos✤ See videos on the module site ✤ C++ ✤ Qt