Register now or log in to join your professional community.
<p><strong>Why To make that ? To help any one to switch between programming languages very fast </strong></p> <p> </p> <p><strong>plz write the template with the following roles </strong></p> <p> </p> <p><strong>//1- class name will be Class_Name and if it is extended it will be extended from Parent_Class _Name</strong></p> <p> </p> <p><strong>class template </strong></p> <p><strong>{</strong></p> <p><strong>//2- Visibility Scope (e.g public , protected , private etc ) with variables type (if there is ) and variable name that will be Variable_Name1 , Variable_Name2 or Object_Variable_Name1 , Object_Variable_Name2 etc </strong></p> <p><strong> </strong></p> <p><strong>//3- construction and destruction function and Multiple constructors with different parameters if the programming language allow that and what to do if the language don't allow that </strong></p> <p><strong> </strong></p> <p><strong> </strong></p> <p><strong>//4- Visibility Scope with function with name Function_Name() that contain if else , for , while and do while statements</strong></p> <p> </p> <p><strong> //5 - getter and setter methods for protected properties of classes}</strong></p>
visual basic most recent version
Python and java are best two programming languages
package aslam.com;
class Program
{
public static void main(String[] args)
{
System.out.println("Java is the most secured and platform independent programming Language");
}
}
// This is the programming sample of Java
---------------------------------------------------------------------
<!----This is format of Web Desing
<!Doctype html>
<html>
<head>
<title>Web Page </title>
</head>
<body>
</body>
</html>
</head.
template <class T>
T add(T v1, T v2){ // Generic Type T
T sum = v1+v2; // Sum any Values of Generic Type T
return sum;
}
<!doctype html>
<html>
<head>
<title>My First Webpage</title>
!
<meta charset="utf-8" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
!
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/
bootstrap.min.css">
!
<!-- Optional theme -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/
bootstrap-theme.min.css">
!
!
<style>
!
html, body {
height:100%;
}
!
.container {
background-image:url("background.jpg");
width:100%;
height:100%;
background-size:cover;
background-position:center;
padding-top:100px;
}
!
.center {
text-align:center;
}
!
.white {
color:white;
}
!
p {
padding-top:15px;
padding-bottom:15px;
}
!
button {
margin-top:20px;
margin-bottom:20px;
}
!
.alert {
margin-top:20px;
display:none;
}
</style>
!
!
</head>
!
<body>
!
<div class="container">
!
<div class="row">
!
<div class="col-md-6 col-md-offset-3 center">
!
<h1 class="center white">Weather Predictor</h1>
!
<p class="lead center white">Enter your city below to get a forecast for the
weather.</p>
!
<form>
!
<div class="form-group">
!
<input type="text" class="form-control" name="city" id="city" placeholder="Eg.
London, Paris, San Francisco..." />
!
</div>
!
<button id="findMyWeather" class="btn btn-success btn-lg">Find My Weather</
button>
!
!
</form>
!
!
<div id="success" class="alert alert-success">Success!</div>
!
<div id="fail" class="alert alert-danger">Could not find weather data for that
city. Please try again.</div>
!
<div id="noCity" class="alert alert-danger">Please enter a city!</div>
!
</div>
!
!
!
!
!
</div>
!
!
</div>
!
!
!
!
!
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
!
!
<!-- Latest compiled and minified JavaScript -->
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></
script>
!
<script>
!
$("#findMyWeather").click(function(event) {
event.preventDefault();
$(".alert").hide();
if ($("#city").val()!="") {
$.get("scraper.php?city="+$("#city").val(),
function( data ) {
if (data=="") {
$("#fail").fadeIn();
} else {
$("#success").html(data).fadeIn();
}
});
} else {
$("#noCity").fadeIn();
}
});
!
!
</script>
!
</body>
</html>
Yes, I can do it. it depends of the algorithm
The is example class template in Swift
import UIKit
class SampleVC: UIViewController, UITableViewDataSource, UITableViewDelegate
{
//MARK: IBOutlets
@IBOutlet weak var nameBtn: UIButton!
@IBOutlet weak var anotherBtn: UIButton!
//MARK: CONSTANTS
//private and fileprivate constants
private let someConstant: Int = 0
private let anotherConstant: String = "Hello"
//public constants
let somePublicConstant: Int = 0
let someOtherConstant: String = "Hello again"
//MARK: VARIABLES
//private and fileprivate vars
private var someVariable: Int?
private var anotherVariable: String?
//public constants
var somePublicVariable: Int?
var anotherPublicVariable: String?
//MARK: INIT and DEINIT methods
convenience init()
{
self.init()
}
required init?(coder aDecoder: NSCoder)
{
fatalError("init(coder:) has not been implemented")
}
deinit
{
}
//MARK: OVERRIDE METHODS
override func viewDidLoad()
{
super.viewDidLoad()
}
override func didReceiveMemoryWarning()
{
super.didReceiveMemoryWarning()
//Dispose of any resources that can be recreated.
}
//MARK: PRIVATE METHODS
private func somePrivateMethod()
{
}
//MARK: PUBLIC METHODS
func somePublicMethod()
{
}
//MARK: DELEGATE METHODS
//MARK: UITableViewDelegate
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat
{
return 100
}
//MARK: UITableViewDataSource
func numberOfSections(in tableView: UITableView) -> Int
{
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
{
return 5
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
{
let cell: BaseTableViewCell = tableView.dequeueReusableCell(withIdentifier: "cell") as! BaseTableViewCell
return cell
}
}
When you know how to create templates and their properties..why are you posting/asking ..?
I'll provide a template class in C++, a language known for its flexibility and powerful template system. This class will demonstrate basic features like generic types and operations, which can be useful for a wide range of applications.
C++ Template Class Example cpp Copy #include using namespace std; // Template class definition template <typename T> class Box { private: T value; // Value of the box (could be any type) public: // Constructor to initialize the box with a value Box(T val) : value(val) {} // Getter for the value T getValue() const { return value; } // Setter for the value void setValue(T val) { value = val; } // A function to compare two boxes bool operator==(const Box& other) const { return value == other.value; } // A function to display the value void display() const { cout << "Value in the box: " << value << endl; } }; int main() { // Example of using Box with int Box<int> intBox(10); intBox.display(); // Example of using Box with string Box strBox("Hello, World!"); strBox.display(); // Example of using comparison operator Box<int> anotherIntBox(10); if (intBox == anotherIntBox) { cout << "The boxes have the same value!" << endl; } return 0; } Key Concepts in this Example:This class is highly flexible and can be reused in various contexts, whether you are working with integers, strings, or custom types. Templates in C++ provide a powerful way to write generic and reusable code.