Code:
@interface Megatron : NSObject {
NSString * const RANK;
}
@end
How do i initialize RANK?
Basically, I'm looking for the Objective-C equivalent to the following C++ program.
Code:
class Megatron {
private:
const std::string RANK;
public:
Megatron();
void print();
};
Code:
#include <stdio.h>
#include <string>
#include <iostream>
#include "Megatron.h"
Megatron::Megatron(): RANK("Leader") {
}
void Megatron::print() {
std::cout << RANK << "\n";
}